A typical structural model
Activitya contains VIEWGROUPB,VIEWGROUPB containing VIEWC, where VIEWGROUPB (intermediate node) is selected as the current node perspective
Procedure one: The event relationship between the current node and the parent node
Activitya only cares about the Viewgroupb.ondispatchtouchevent return value, as long as B.ondispatchtouchevent () returns true during the Action_down distribution process, Then the subsequent events will be distributed to B. As for how VIEWGROUPB is handled in the Ondispatchtouchevent method, the parent node Activitya does not ask.
In other words, the parent node VIEWGROUPB the Action_down event to the Direct child node , and the child node responds with the return value of the Ondispatchtouchevent method, as long as the child node represents the ability to handle Action_down, The parent node then continues to hand over the subsequent events to the child nodes.
Procedure two: The event relationship between the current node and the child node
VIEWGROUPB The Action_down event is received from the previous level, onintercepttouchevent is called to determine whether to intercept. If not intercepted, then the process is consistent with the above "process one", if intercepted, then VIEWGROUPB will eat the event, directly ignore the VIEWC.
However, Onintercepttouchevent is an internal method, and the method itself does not affect the Ondispatchtouchevent return value of the current node.
Ondispatchtouchevent of the return value
Typically, the ondispatchtouchevent return value of a node is only related to the Ontouchevent return value of the current node and the Ondispatchtouchevent return value of the child node:
this.onDispatchTouchEventValue = child.onDispatchTouchEventValue || this.onTouchEvent
Of course, you can also force a return value to ondispatchtouchevent, however, it should not be forced to discard the original event mechanism, because the original event mechanism will be some state cleanup and other operations.
Action_down Example diagram:
Android Share Q Group: 315658668
"Android" touch-screen event delivery brief