我需要在Android
我正在开发的应用程序中检测两指点击。我还使用ScaleGestureDetector
andGestureDetector
来检测轻击、双击、长按和缩放。
在我的onTouchEvent
方法中,我有:
@Override
public boolean onTouchEvent(MotionEvent event) {
scaleGestureDetector.onTouchEvent(event);
gestureDetector.onTouchEvent(event);
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
activePointerId = event.getPointerId(0);
break;
.
.
.
case MotionEvent.ACTION_POINTER_UP:
int pointerId = event.getPointerId(event.getActionIndex());
if (pointerId == activePointerId) {
// change active pointer
} else if (!scaleDetector.isInProgress() && (event.getPointerCount() == 2)) {
// handle two-finger tap
}
break;
.
.
.
问题是规模也被检测为两指轻敲。关于解决这个问题的任何想法?谢谢!