开发者

capture two-finger scroll event on android 2.2

开发者 https://www.devze.com 2023-03-31 15:12 出处:网络
I\'m looking for a way to implement gestures for zoom, pan and rotate in a 3d app. I\'m using a ScaleGestureDetector for the zoom events and a GestureDetector for the pan. I was hoping to be able to d

I'm looking for a way to implement gestures for zoom, pan and rotate in a 3d app. I'm using a ScaleGestureDetector for the zoom events and a GestureDetector for the pan. I was hoping to be able to differentiate between a two-finger scroll and a one-finger scroll through the getPointerCount() method on the MotionEvent that comes in, but any time it sees it as a two-point scroll, the scale detector kicks in. the regular detector never gets passed a motionevent where the pointer count is > 1.

any ideas? is it a matter of setting a span threshold internally and returning false from the 开发者_开发问答onScale event when it's below the threshold?


What you mentioned is one option. You can return false in the onScaleBegin() when it is below the threshold.

Also, there is a GestureDetector constructor which takes a boolean ignoreMultiTouch. If you set this to false, it will still attempt to interpret the gestures, even with multiple pointers. I don't know how well it would work out with a scale detector at the same time.

0

精彩评论

暂无评论...
验证码 换一张
取 消