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