MotionEvent.getRawX和MotionEvent.getX的区别 [英] Difference between MotionEvent.getRawX and MotionEvent.getX
问题描述
我想知道的区别 MotionEvent.getRawX
和 MotionEvent.getX
在Android作为一个是数字另一个是浮?请告诉我需要有这两种类型的?
I would like to know The difference between MotionEvent.getRawX
and MotionEvent.getX
in android as one is numeric and the other is float?Whats the need to have both of these types?
推荐答案
MotionEvent
有时会返回绝对X和相对的Y坐标,有时相对坐标为previous运动盛会。
MotionEvent
will sometimes return absolute X and Y coordinates relative to the view, and sometimes relative coordinates to the previous motion event.
getRawX()
和 getRawY()
这是保证返回绝对坐标,相对于设备屏幕。
getRawX()
and getRawY()
that is guaranteed to return absolute coordinates, relative to the device screen.
在的getX()
和 getY()以
,应该返回你的坐标,相对于视图,分派它们。
While getX()
and getY()
, should return you coordinates, relative to the View, that dispatched them.
这篇关于MotionEvent.getRawX和MotionEvent.getX的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!