简体   繁体   English

在Android 2.2上捕获两指滚动事件

[英]capture two-finger scroll event on android 2.2

I'm looking for a way to implement gestures for zoom, pan and rotate in a 3d app. 我正在寻找一种在3d应用中实现缩放,平移和旋转手势的方法。 I'm using a ScaleGestureDetector for the zoom events and a GestureDetector for the pan. 我将ScaleGestureDetector用于缩放事件,将GestureDetector用于平移。 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. 我希望能够两手指滚动,并通过一个手指滚动区分getPointerCount()的方法MotionEvent附带在,但任何时候它认为它作为双点滚动,规模检测器踢in。常规检测器永远不会传递指针计数> 1的motionevent。

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? 在内部设置跨度阈值,并在低于阈值时从onScale事件返回false是问题吗?

What you mentioned is one option. 您提到的是一种选择。 You can return false in the onScaleBegin() when it is below the threshold. 低于阈值时,可以在onScaleBegin()中返回false。

Also, there is a GestureDetector constructor which takes a boolean ignoreMultiTouch. 此外,还有一个GestureDetector 构造函数 ,该构造函数使用布尔值ignoreMultiTouch。 If you set this to false, it will still attempt to interpret the gestures, even with multiple pointers. 如果将其设置为false,即使有多个指针,它仍将尝试解释手势。 I don't know how well it would work out with a scale detector at the same time. 我不知道同时使用刻度尺检测器会产生多大的效果。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM