Android 1.5 多点触控
有谁知道是否可以在 Android 1.5 设备上使用多点触控?
我有一台 HTC Hero,它仍然运行 1.5(HTC 在推出 2.1 ROM 方面有点慢)。
Android MotionEvent 文档显示了常量(ACTION_POINTER_1_DOWN、ACTION_POINTER_1_UP...等...)我需要实现多点触控,因为它只能从 API 5 中获得:(
除了等待 HTC 更新之外,还有其他方法可以解决这个问题吗?或者购买 2.1 手机
?
public boolean onTouchEvent (MotionEvent event) {
//TODO: determine if the event object is an ACTION_POINTER_DOWN etc...
//for ACTOIN_DOWN it is
if(event.getAction() == MotionEvent.ACTION_DOWN) {
//do something here.....
}
}
Does anyone know if it's possible to use Multitouch on an Android 1.5 device?
I have a HTC Hero, and it's still running 1.5 (HTC have been a little slow on getting the 2.1 ROM out).
The Android MotionEvent documentation shows the constants (ACTION_POINTER_1_DOWN, ACTION_POINTER_1_UP.....etc...) I need to implement multitouch as only avaliable from API 5 :(
Is there a way round this other then waiting for HTC to get the update out or buying a 2.1 handset?
Code Snippet:
public boolean onTouchEvent (MotionEvent event) {
//TODO: determine if the event object is an ACTION_POINTER_DOWN etc...
//for ACTOIN_DOWN it is
if(event.getAction() == MotionEvent.ACTION_DOWN) {
//do something here.....
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这篇文章< /a> 在用户的上下文中对此进行了一些讨论。理所当然的是,如果浏览器支持它(我假设你的英雄拥有必要的硬件......),你作为开发人员就可以访问它。也就是说,它可能不是公共 api 的一部分,但即使是这样,您也可以只使用反射来调用方法。这不是一个很好的答案,但您可以从存储库下载纸杯蛋糕源代码并深入浏览器代码以了解它们如何实现多点触控功能。
This post discusses it a bit in the context of users. It would stand to reason that if the browser supports it (I'm assuming your hero has the requisite hardware...) you as a developer could access it. That said, it's possible that it's not part of the public api but even if that's the case, you could just use reflection to call the methods. This isn't a great answer, but you could download the cupcake source from the repo and dig through the browser code to see how they implement the multitouch stuff.
这里你有一个例子,它在我的英雄上运行良好,但是我的 onscroll 方法仍然存在问题,该方法有时会被调用,因为没有内置事件来告诉我的 Activity 我正在缩放。
here you have an example, it works fine on my Hero, but I still have issues with my onscroll method which is called sometimes, since there is no builtin events to tell my Activity I am zooming.