1

Added a spaceView that doesn't cover all of the layout. And I want gesture detection work for only that view.

Couldn't do much but here is my codes:

space = findViewById(R.id.space);
        this.gDetector = new GestureDetectorCompat(this, this);
        gDetector.setOnDoubleTapListener(this);
  • Try adding onTouchEvent to it [Here's](https://stackoverflow.com/questions/45054908/how-to-add-a-gesture-detector-to-a-view-in-android) what that can be helpful – Anchit Sep 08 '18 at 16:58
  • @Anchit Finally I did it! Answer if you want, I'm gonna accept it! –  Sep 08 '18 at 19:38

1 Answers1

0

The onTouchEvent in Android lets you do so. You can add whatever you want to do in that event.

As per Android Studio's official site, onTouchEvent() is described as ...

When a user places one or more fingers on the screen, this triggers the callback onTouchEvent() on the View that received the touch events. For each sequence of touch events (position, pressure, size, addition of another finger, etc.) that is ultimately identified as a gesture, onTouchEvent() is fired several times.

Here's the official link to you for further help

Hope this helps...

Anchit
  • 171
  • 1
  • 11