Detect multitouch with Ontouch listener Android

旧城冷巷雨未停 提交于 2019-12-18 09:26:59

问题


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?


回答1:


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 Docs

HTH




回答2:


This is a nice example



来源:https://stackoverflow.com/questions/8002003/detect-multitouch-with-ontouch-listener-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!