To summarize:
There are only two main characters in 1.Touch event distribution:
ViewGroup and view.
ViewGroup contains three related events for Onintercepttouchevent, Dispatchtouchevent, Ontouchevent. View contains Dispatchtouchevent, ontouchevent two related events. Where ViewGroup is inherited from view.
2. Touch events consist of Action_down, Action_move, Aciton_up, and in one complete touch event, down and up are only a maximum of one, and the Move has several, which can be 0.
3. Two ways to pass the event:
tunnel mode : passes from the root element down to the most inner child element or in an intermediate element because a condition stops passing;
bubbling : passes outward from the most inner child element to the root element or to an element in the middle because a condition stops passing.
Dispatchtouchevent is the tunnel mode, Ontouchevent is the bubbling mode (if true, the upper layer is no longer processed).
4. Onintercepttouchevent has two functions:
Interception of the distribution of down events;
Aborts the up and move events to the target view, allowing the viewgroup of the target view to capture the up and move events.
Reference: "Android event distribution mechanism fully resolved, take you from the point of view of the source of the thorough understanding"
The "Android Development Pit Series" event