简体   繁体   English

使用Ontouch侦听器Android检测多点触控

[英]Detect multitouch with Ontouch listener Android

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. 我目前有一个imageview元素,在被触摸时,它测试动作是否是一个动作下降事件,如果是,它会用getraw(x或y)获取触摸的坐标,然后根据这些坐标执行动作。 How would I implement this to get two sets of coordinates from a two finger multitouch event? 如何实现此功能以从两指多点触摸事件中获取两组坐标?

Take a look at the ACTION_POINTER_DOWN action define in MotionEvent . 看看在ACTION_POINTER_DOWN动作定义MotionEvent This is the event that will get called when additional fingers come down after the first ACTION_DOWN triggers. 在第一个ACTION_DOWN触发器触发后,当另外的手指下垂时,将调用此事件。 You can use methods like getActionMasked() to assist you in determining which finger events are related to. 您可以使用诸如getActionMasked()类的方法来帮助您确定与哪些手指事件相关。

MotionEvent Docs MotionEvent文档

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM