android View事件传递
来源:互联网 发布:淘宝网书店 编辑:程序博客网 时间:2024/06/03 15:56
1:首先调用父类的LinearLayout/RelativeLayout 的dispatchTouchevent(MotionEvent event)进行事件的分发
(1):返回true:处理事件
(2):返回false,交给自己的onTouchEvent进行处理
(3):返回:return super.dispatchTouchEvent(ev);调用子View的dispathTouchevent(MotionEvent event);
如果子view为ViewGroup,继续遵循上述处理方式进行处理,如果子view为具体view,
2: 调用子view(具体的view,如button,TextView,ImageView等)的dispatchTouchevent(MotionEvent event)进行处理,
(1)返回ture,处理事件,不往下传递
(2)返回false,交给onTouchEvent(MotionEvent event)处理
(3)返回super.dispatchTouchevent(MotionEvent event)与返回false一样,
注意:如果在Action.Down的时候,onTouchEvent(MotionEvent event)返回false,则后续的Action.MOVE,和Action.UP不会继续到底此View
<=======================================================================================>
附件有测试demo
0 0
- Android View 事件传递
- android View事件传递
- Android的View 事件传递
- Android View 事件传递机制
- Android View事件传递机制
- android view 原理 -- 事件传递
- Android-view事件传递机制
- 【Android View】 事件传递机制
- android view事件传递总结
- Android View 触摸事件传递
- Android事件传递(一View事件的传递)
- android View 的ontouch事件传递过程
- Android事件传递机制-View篇
- Android中的View事件传递机制
- Android事件传递机制-View篇
- android平级View之前的事件传递
- android view 触屏事件传递原理
- android View 绘制流程 和 事件传递
- 开发一个App要100万?太扯淡
- 网络攻击
- C#Xml,json解析以及Socket传输问题
- 从Android运行时出发,打造我们的脱壳神器
- AFNetworking 支持cookies的解决方案
- android View事件传递
- Codeforces Round #326 (Div. 2) D. Duff in Beach(LIS)
- UE4 main classes explanation
- MR-2.MapReduce序列化&反序列化&MapReduce函数
- Postgresql通过批处理命令执行sql文件
- VMware中的Linux通过NAT方式和本机联网设置
- poj-2352 && HDU-1541 --Stars(树状数组)
- CentOS6.5 python+ipython安装
- Qt之进程间通信(IPC)