dec*_*des 6 android gesture-recognition
上面的问题.对我来说,一旦检测到双击,getPointerCount()始终为1.
private GestureDetector mGestureDetector;
mGestureDetector = new GestureDetector(this, new MyGestureListener());
Run Code Online (Sandbox Code Playgroud)
...
public boolean onTouch(View v, MotionEvent event) {
return mGestureDetector.onTouchEvent(event);
}
Run Code Online (Sandbox Code Playgroud)
...
private class MyGestureListener extends GestureDetector.SimpleOnGestureListener {
@Override
public boolean onDoubleTap(MotionEvent e) {
return super.onDoubleTap(e);
}
}
Run Code Online (Sandbox Code Playgroud)
它GestureDetector只能检测“一根手指”手势。您当前听到的“双击”手势发生在用户用一根手指轻击、释放并再次轻击屏幕时。
如果你想用多个手指听手势,你必须自己做或使用ScaleGestureDetector(仅适用于缩放手势)。