Android: Two fingers with double tap can be detected using GestureDetector?

question above. For me, getPointerCount () is always 1, after detecting a double click.

private GestureDetector mGestureDetector; mGestureDetector = new GestureDetector(this, new MyGestureListener()); 

...

  public boolean onTouch(View v, MotionEvent event) { return mGestureDetector.onTouchEvent(event); } 

...

 private class MyGestureListener extends GestureDetector.SimpleOnGestureListener { @Override public boolean onDoubleTap(MotionEvent e) { return super.onDoubleTap(e); } } 
+6
source share
1 answer

GestureDetector is only capable of detecting one-finger gestures. The โ€œdouble-tapโ€ gesture that you are currently listening to occurs when the user knocks, releases, and then again presses the screen with one of his fingers.

If you want to listen to gestures with a few fingers, you will have to do it yourself or use the ScaleGestureDetector (only for scale gestures).

+2
source

Source: https://habr.com/ru/post/885904/


All Articles