机器人:ACTION_UP和ACTION_POINTER_UP之间的区别 [英] android: difference between ACTION_UP and ACTION_POINTER_UP

查看:998
本文介绍了机器人:ACTION_UP和ACTION_POINTER_UP之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单从Android的文档我真的不明白ACTION_UP和ACTION_POINTER_UP之间的差异。 <一href="http://developer.android.com/reference/android/view/MotionEvent.html#ACTION_DOWN">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)

谢谢!

推荐答案

我相信它的多点触控梗被加了进来,因为API级别1 ACTION_UP一直都在,但ACTION_POINTER_UP中添加了API级别5时多点触摸加入。

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.

你得到的结果将取决于哪种方法,你在呼唤,的getAction()将返回ACTION_UP而getActionMasked()将给ACTION_POINTER_UP也让你调用getActionIndex(),以找出其中的多点触控指针的刚被提出。我觉得这是你想要做什么。

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.

这篇关于机器人:ACTION_UP和ACTION_POINTER_UP之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆