Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove gestures from Android Q

I have a kids drawing app, but the gestures in Q keep quitting the app. I tried removing the system gesture but it does not seem to work.

In this case, I am trying to exclude the whole screen from system gesture:

List<Rect> exclusionRects = new ArrayList();

public void onLayout(boolean changedCanvas, int left, int top, int right, int bottom) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
        exclusionRects.clear();
        exclusionRects.add(new Rect(left, top, right, bottom));
        setSystemGestureExclusionRects(exclusionRects);
    }
}
like image 457
Lim Thye Chean Avatar asked Oct 28 '25 21:10

Lim Thye Chean


1 Answers

As stated by Google:

First, to ensure reliable and consistent operation, there’s a 200dp vertical app exclusion limit for the Back gesture.

https://android-developers.googleblog.com/2019/08/final-beta-update-official-android-q.html

This means that the operating system will not allow you to override the back gesture fully.

This makes sense as it is a fairly fundamental part of the operating system and they probably don't want to allow apps that remove the gesture entirely, as it is bad for consistency across the platform

like image 198
cameron1024 Avatar answered Oct 30 '25 13:10

cameron1024



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!