Research on the transmission mechanism of Android events

Source: Internet
Author: User

The current understanding:

1. When the button is clicked, the event that is captured in turn is Down,move,up

2. When up, the event stream is processed to the Click event

3.

Activity---dispatchtouchevent---down

Rtlayout---dispatchtouchevent---down

Rtlayout---onintercepttouchevent---down

Rtbutton---dispatchtouchevent---down

Rtbutton---onTouch---down

Rtbutton---ontouchevent---down


Interpretation: First into the activity event distribution process, the Super method will be distributed to--

Dispatch method for----next-level view

------Dispacth method to enter the interceptor again

----If the interceptor returns True, it indicates that running through

----now go to the next level of dispatch

At this point, the underlying view has been reached, with touch and TouchEvent in dispatch, and the clicked event if the up type is performed

If the result returned by TouchEvent is False (the system defaults to false), then the dispatch result is false, indicating that the event was not

Consumption, then to the upper level of dispatch continue to deal with the implementation of touch, touchevent consumption, and so on ...


There's also a long press event delivery problem???

and the interception mode of inquiry???


Reference: http://www.infoq.com/cn/articles/android-event-delivery-mechanism/


Research on the transmission mechanism of Android events

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.