android 管理Touch事件

The onInterceptTouchEvent() method gives a parent the chance to see any touch event before its children do. If you return truefrom onInterceptTouchEvent(), the child view that was previously handling touch events receives an ACTION_CANCEL, and the events from that point forward are sent to the parent'sonTouchEvent() method for the usual handling.onInterceptTouchEvent() can also return false and simply spy on events as they travel down the view hierarchy to their usual targets, which will handle the events with their own onTouchEvent().

 

onInterceptTouchEvent()方法,如果返回true,则子child再也不会受到touch事件,此时父类的onTouchEvent()事件被调用。

返回false,则会一直往下传,直到最终的目标View处理调用它自己的onTouchEvent().

posted on 2013-10-13 17:52  meizixiong  阅读(157)  评论(0编辑  收藏  举报