Android——交互事件的知识总结

1.OnTouchListener

OnTouch方法中,MotionEvent.getX()和MotionEvent.getRawX()的区别

动作常量:

MotionEvent.ACTION_DOWN:当屏幕检测到第一个触点按下之后就会触发到这个事件

MotionEvent.ACTION_MOVE:当触点在屏幕上移动时触发,触点在屏幕上停留也是会触发的(即使我们感觉不到移动,但其实我们的手指也在不停地抖动)

MotionEvent.ACTION_UP:当触点松开时被触发

MotionEvent.ACTION_CANCEL:不是由用户直接触发,由系统在需要的时候触发,表示手势被取消了

猜你喜欢

转载自blog.csdn.net/hzkcsdnmm/article/details/112985233