Android 中检测捏合
我想在我的 Android 应用程序中处理捏合事件来放大和缩小。
我相信 Android 2.0 具有多点触控功能,并且听说 Android 1.6 可能支持也可能不支持,具体取决于设备。
检测捏合事件的最佳方法是什么,同时对于不支持它的设备优雅地降级?我的目标是 Android 1.5 以上。
I would like to handle pinch events in my Android application to zoom in and out.
I believe Android 2.0 has multi-touch functionality, and heard that Android 1.6 might or might not support it depending of the device.
What's the best way to detect pinch events, while degrading gracefully for devices that don't support it? I'm targeting Android 1.5 upwards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Ed Burnette(Hello Android 作者)关于多点触控(包括捏合缩放)的精彩文章可以在这里找到:http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2/1747
这是 Android 开发人员博客上的一篇文章,介绍如何在支持新 API 的设备上利用新 API 的功能,同时继续优雅地支持旧设备。
http://android-developers.blogspot.com/2009 /04/backward-compatibility-for-android.html
A great article by Ed Burnette (Hello Android Author) on multi touch (including pinch zoom) can be found here: http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2/1747
Here's an article on the Android developer blog about taking advantage of capability of the newer APIs on devices that support them, while gracefully continuing to support older devices.
http://android-developers.blogspot.com/2009/04/backward-compatibility-for-android.html
Android 1.6 不支持多点触控,Android 2.0 及更高版本支持多点触控,这意味着您需要有不同的 OnTouchHandler,您可以根据检测到的 Android 版本进行交换。有关如何实现捏缩放的更多信息,请查看 此线程。
Android 1.6 does not support multi-touch, Android 2.0 and above does, that means that you would need to have different OnTouchHandlers that you can swap in based on the version of Android you detect. For more information about how to implement the pinch-zoom, have a look at this thread.