Android 多点触控支持
不知道Android的多点触控支持可靠吗?我读过它遇到了一些问题。
我还想知道,如何定义自定义多点触控手势?例如:3 个手指旋转或 3 个手指保持静止,第四个手指移动。
我遇到过一些资源(developer.android.com 上的 Gestures 或 MotionEvent),但没有明确说明。
问候,
兹德内克
I wonder if is the Android multi-touch support reliable? I've read it suffers from some problems.
I also wonder, how can I define custom multi-touch gestures? Like: 3 fingers rotate or 3 fingers stay static and fourth is moving.
I've come across some resources (Gestures or MotionEvent on developer.android.com) but nothing states it clearly.
Regards,
Zdenek
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经深入研究了 API,找到了一种执行捏合/反向捏合等手势的方法,所以我相信您描述的手势是可能的 - 只需弄清楚如何对它们进行编码即可。下面我粘贴了一个我实现的反向捏合的示例。我希望捏合仅在水平方向时才记录。它不是很干净或可重用的代码,但它应该可以帮助您继续前进。它适用于 Android 2.0.x。我读过多点触控在早期版本上可能存在问题。该示例是我从活动的 onTouchEvent 中调用的一个类,将事件转发到该类。
从可靠性来看,这段代码是完全可靠的。再次强调,仅适用于 Android 2.0.x。我还没有在该平台的其他版本上进行过测试。
I've dug around in the API and found a way to perform gestures like pinch / reverse pinch, so I believe the gestures you describe are possible - it just takes figuring out how to code them up. Below I've pasted an example of a reverse pinch I implemented. I wanted the pinch to only register if it is horizontally-oriented. Its not very clean or reusable code but it should help you get moving forward. It works on Android 2.0.x. I've read multi-touch may have issues on earlier versions. The example is a class that I call from within an activity's
onTouchEvent
, forwarding the event to the class.Regarding reliability, this code has been completely reliable. Again, only on Android 2.0.x. I have not tested it on other versions of the platform.