检测多点触控与Ontouch监听器的Andr​​oid [英] Detect multitouch with Ontouch listener Android

查看:78
本文介绍了检测多点触控与Ontouch监听器的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在有一个imageview的元件,其在被触摸时,该试验,如果动作是actiondown事件,如果是,则它得到的触摸的坐标与getraw(x或y),然后执行基于一个动作这些坐标。我将如何实现这个拿到两套坐标从两个手指多点触控事件?

I currently have an imageview element that upon being touched, that tests if the action is an actiondown event, and if it is, it gets the coordinates of the touch with getraw(x or y) and then carries out an action based on those coordinates. How would I implement this to get two sets of coordinates from a two finger multitouch event?

推荐答案

看看的 ACTION_POINTER_DOWN 操作定义 MotionEvent 。这是将被调用时,额外的手指后的第一个回落的情况下 ACTION_DOWN 触发。你可以使用像 getActionMasked方法()来帮助您确定哪个手指的事件都涉及到。

Take a look at the ACTION_POINTER_DOWN action define in MotionEvent. This is the event that will get called when additional fingers come down after the first ACTION_DOWN triggers. You can use methods like getActionMasked() to assist you in determining which finger events are related to.

MotionEvent文档

心连心

这篇关于检测多点触控与Ontouch监听器的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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