Android Event delivery mechanism experience

Source: Internet
Author: User

Read a lot of information on the Internet.

In the end, I found that I could make it clear in a few simple words.

1 There are three methods in each ViewGroup

A dispatchtouchevent is the one who decides if he wants to do this. The general use of this apple is in this method
GetParent (). Requestdisallowintercepttouchevent (False/true)
True means that the Apple has got the hand  false means no, the Apple is still at his father's

b oninterceptouchevent is this apple to be issued, (to this step to explain the last step is to, Apple got the hand)

C ontouchevent Apple eats itself, (this step is carried out to the words of the more special, in two cases,


The second is that there is   no downward hair Oninterceptouchevent returns True

Ate it directly,

The first is that it is issued, Oninterceptouchevent returns False (by default)
But his son did not, and returned up again, the ontouch of the child view  returned false
He had a chance to eat it.

Supplementary Knowledge View only Ontouch methods do not have dispatch and intercept methods,

Android Event delivery mechanism experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.