OnTouch and onTouchEvent methods, ontouchevent

Source: Internet
Author: User

OnTouch and onTouchEvent methods, ontouchevent

1. onTouch () method

It is defined in the onTouchListener () interface of the view. When a view is bound with an onTouchListener and triggered by a touch event, the onTouch () method is called to put the view on your fingers, will be called once)


2. onTouchEvent

Is the activity method. After the onTouchEvent method of the activity is rewritten, the screen will be triggered when there is a touch event. This method will be called (put your finger on the activity, will be called continuously)


3. Transfer of touch events

If a TextView is placed in an activity clock and set to fill_parent, The onTouch () method is executed when the finger is put on.

If onTouch () returns true, it indicates that the processing is complete, and the touch event will not be passed to the activity, that is, the onTouchEvent () method will not be called,

If the onTouch () method returns false, it indicates that the event is not processed completely. In this case, the touch event is passed to the activity, that is, the onTouchEvent () method is called.

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.