初识view

屏幕左上角为原点,向右为 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 坐标。

 

posted @ 2016-03-13 22:56  LeslieFang  阅读(213)  评论(0编辑  收藏  举报