首页 > 其他 > 详细

初识view

时间:2016-03-13 23:43:42      阅读:257      评论:0      收藏:0      [点我收藏+]

屏幕左上角为原点,向右为 x 轴, 向下为 y 轴。

getLeft getTop getRight getBottom 分别返回 view 的左上右下的坐标,这里的坐标都是相对于view的父view来说的。

width = getRight() - getLeft()

height = getBottom() - getTop()

MotionEvent 中 getX/getY 返回的是相对于当前 view 左上角 x 和 y 的坐标, getRawX/getRaxY 返回的是相对于手机屏幕左上角的 x 和 y 坐标。

 

初识view

原文:http://www.cnblogs.com/lesliefang/p/5274088.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!