Android Touch Event

Source: Internet
Author: User
Brief introduction:

Made a small demo of the voice sending UI.

Press to display the Voice window, according to the volume Adjustment UI volume display, up to the window display cancel send.



Principle:

1: Get what event to perform the operation:

Adds a Setontouchlistener event to the button, obtains a touch event, obtains the coordinates of the current display control in a sliding event, and then determines whether to cancel based on the current touch position and coordinates. 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.

Detailed events:

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


Directly attach the source code bar, do not reach the party, thank you for your support.

Thus, through this demo link, later on gesture operation, sliding event monitoring, have a deep understanding.

Question: How is the touch event assignment mechanism for Android, only to know that 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.

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

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.