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