android:ACTION

编程入门 行业动态 更新时间:2024-10-28 12:30:04
android:ACTION_UP和ACTION_POINTER_UP之间的区别(android: difference between ACTION_UP and ACTION_POINTER_UP)

从单独的android文档我真的不明白ACTION_UP和ACTION_POINTER_UP之间的区别。 http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_DOWN

基本上我想捕获一个手指从屏幕上释放的事件(即使另一个手指仍然可以触摸它)

谢谢!

from the android doc alone i dont really understand the difference between ACTION_UP and ACTION_POINTER_UP. http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_DOWN

basically i want to capture the event when one finger is released from the screen (even if another one may still be touching it)

thanks!

最满意答案

我相信这是源自添加了多点触控,ACTION_UP自API Level 1开始,但在添加多点触控时添加了ACTION_POINTER_UP。

你得到的结果将取决于你调用的方法,getAction()将返回ACTION_UP,而getActionMasked()会给ACTION_POINTER_UP,但也允许你调用getActionIndex()来找出哪些多点触控指针刚被引发。 我认为这是你想要做的。

I believe it stemmed from Multi-touch being added in, ACTION_UP has been in since API Level 1, but ACTION_POINTER_UP was added in API Level 5 when multi-touch was added.

The result you get will depend on which method you are calling, getAction() would return ACTION_UP whereas getActionMasked() would give ACTION_POINTER_UP but also allow you to call getActionIndex() to find out which of the multi-touch pointers has just been raised. I think this is what you want to do.

更多推荐

本文发布于:2023-08-05 07:21:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1428751.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:android   ACTION

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!