Android Touch Event

Source: Internet
Author: User

Brief introduction:

Made a small demo of the voice sending UI.

Press the show voice form to display the volume adjustment UI volume, up to the form display cancel send.



Principle:

1: Get what event to run the operation:

Add the Setontouchlistener event to the button, get a touch event, get the coordinates of the current display control in the slide event, and then infer from the current touch position and coordinates to determine whether to cancel.

Determines whether to process the sent request in the event of a touch away.

2: Update volume Value:

The volume of the recording is obtained in the thread and then sent to the activity with handler for UI updates.

Specific explanations of events:

The current touch event is obtained through event.getaction in public boolean OnTouch (View arg0, motionevent event) {}. Motionevent.action_down (when pressed) case MOTIONEVENT.ACTION_UP: (finger lift) case motionevent.action_move (finger swipe)


Please attach the source code directly. Do not reach the party. Thank you for your support.

So, through this demo link. In the future, there is a deep understanding of gesture manipulation and the listening of sliding events.

Question: What is the Android Touch event distribution mechanism, just to know. The parent layout event is lower than the child layout event. Know the answer for a moment.

Pictures can not pass, resources are empty.

Csdn is really enough.

Android Touch Event

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.