问题
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.....
}
}
回答1:
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.
回答2:
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.
来源:https://stackoverflow.com/questions/2668828/android-1-5-multitouch