什么是ACTION_CANCEL和ACTION_UP为MotionEvent之间的不同 [英] What's the different between ACTION_CANCEL and ACTION_UP for MotionEvent
问题描述
我想跟踪在屏幕上fingure平局。所以,我所做的是开始录制时motionEvent ACTION_DOWN的位置。但是,我怎么能决定时动作完成,在Action_cancel或Action_up?
I want to track a fingure draw on the screen. So what i did is to start recording the position when motionEvent Action_down. But how can I decide when the action is finish, at Action_cancel, or Action_up?
什么是确切的不同ACTION_CANCEL和ACTION_UP之间?
What's the exact different between ACTION_CANCEL and ACTION_UP?
感谢您的意见。
推荐答案
-
ACTION_UP:一个pressed手势完成,运动包含了最终版的位置,以及自上向下的任何中间点或移动事件
ACTION_UP: A pressed gesture has finished, the motion contains the final release location as well as any intermediate points since the last down or move event.
ACTION_CANCEL:目前的姿态已中止
ACTION_CANCEL: The current gesture has been aborted.
当父占有的运动,例如当用户已经足够拖累整个列表视图,它会开始滚动,而不是让你preSS的按钮它里面发生ACTION_CANCEL。你可以找到更多关于它在的ViewGroup文档:<一href="http://developer.android.com/reference/android/view/ViewGroup.html#onInterceptTouchEvent%28android.view.MotionEvent%29">onInterceptTouchEvent.
ACTION_CANCEL occurs when the parent takes possession of the motion, for example when the user has dragged enough across a list view that it will start scrolling instead of letting you press the buttons inside of it. You can find out more about it at the viewgroup documentation: onInterceptTouchEvent.
所以用ACTION_CANCEL时的动作拖出母公司和ACTION_UP不然。
so use ACTION_CANCEL when the action is dragged out of the parent, and ACTION_UP otherwise.
这篇关于什么是ACTION_CANCEL和ACTION_UP为MotionEvent之间的不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!