Android Touch事件发生后的传递过程
用户触摸屏幕后,由当前可最顶层的viewGroup的dispatchTouchEvent方法开始传递
之后触发onInterceptTouchEvent方法。接着触发OnTouch事件。
流程如下:
首先触发ACTIVITY的dispatchTouchEvent
然后触发ACTIVITY的onUserInteraction
然后触发LAYOUT的dispatchTouchEvent
然后触发LAYOUT的onInterceptTouchEvent。
Android中的Gesture识别(detector)是通过GestureDetector.OnGestureListener接口实现的,这个接口的输入就是生成的Touch事件MotionEvent。
可以根据你要处理的实际情况,把GestureDetector的onTouchEvent放到以上几个方法中处理。
版权声明:
作者:后浪云
链接:https://www.idc.net/help/206438/
文章版权归作者所有,未经允许请勿转载。
THE END