Here is the rules:
- DOWN is the first event to be handled. The one who handles the DOWN will handle all the events in this group.
- The *handle* means the onTouchEvent function of this View returns true.
- The View who returned false will never handle the other event in this group again, never!
- The order of the event processing is: child, parent.
- Only the DOWN may be handled by more than one View, others must be handled only once.
- When the next DOWN occurs, there is a new group creates, and the current group ends.
And when there is a ViewGroup and a View, and the View is the child of the ViewGroup, then the VIewGroup has priority to choose which one can handle this group of events. That is the onInterceptTouchEvent function.
The onInterceptTouchEvent function is the most first handler of the DOWN event. If returns true, then all the events in this group will be handled by ViewGroup, and the child will know nothing happen ;(
If onInterceptTouchEvent returns false, then DOWN will be handled firstly by child then by parent. That is the normal order.
Once onInterceptTouchEvent returns true, then this function will not be involved again, and all the next events will be passed to parent.
If onInterceptTouchEvent returns fasle, then every following event will firstly handled by this one, then pass to the child.
Note that onInterceptTouchEvent function is for dispatching touch events to children. So if the onInterceptTouchEvent retuyrns false and on child handles that event, the parent will handle it by onTouchEvent. If onTouchEvent returns true, then from that on, all the touch events in that group will directly dispatched to onTouchEvent. If onTouchEvent returns false, then no event will dispatch to the parent again.