Android ViewGroup onintercepttouchevent

Source: Internet
Author: User

Public Booleanonintercepttouchevent(motionevent ev)

Implement This method to intercept all touch screen motion events. This allows your to watch events as they is dispatched to

Your children, and take ownership of the "the current gesture on any point.

Using this function takes some care, as it had a fairly complicated interaction View.onTouchEvent(MotionEvent) with, and using it

Requires implementing, as well, the this one in the correct. Events would be received in the following order:

1) You'll receive the down event here.

2) The down event would be being handled either by a child of this view group, or given to your own ontouchevent () method to Handl E

This means your should implement ontouchevent () to return true, so you'll continue to see the rest of the gesture (Instea D of

Looking for a, parent view to handle it). Also, by returning True from Ontouchevent (), you'll not receive any following events in

Onintercepttouchevent () and all touch processing must happen in ontouchevent () like normal.

3) for as long as you return false from this function, each following event (up to and including the final up) would be deli Vered

First here and then to the target ' s ontouchevent ().

4) If You return true from this, you won't receive any following events:the target view would receive the same event but With

The action ACTION_CANCEL , and all further events would be delivered to your ontouchevent () method and no longer appear here.

Returns False (the default), all events from Onintercepttouchevent to Ontouchevent

Returns True, all events are passed only to Ontouchevent

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.