Peterdk
Peterdk

Reputation: 16015

How to disable 3 finger system gestures in app?

I have a multitouch piano app, and some users have apparently the 3 finger screenshot gesture enabled on their device. (It seems not available in Pixel's Android, but I did see it in Redmi phone).

Now, when people play the piano with 3 fingers, a screenshot is made. This ofcourse interferes a lot with the piano.

Is there any way to opt-out of these gestures? I tried setSystemGestureExclusionRects() but that did not have effect on these gestures.

I still want users to be able to make screenshots with the phone buttons if they want, so blocking it fully is not a option (marking it as FLAG_SECURE or so).

Upvotes: 1

Views: 145

Answers (1)

Manoj Kumar
Manoj Kumar

Reputation: 362

I am not sure if it will work for you or not To prevent multi-touch, turn off splitMotionEvents or windowEnableSplitTouch attribute inside your parent view

// Parent layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:splitMotionEvents="false">

    <!--Multi touch is disabled here-->
</LinearLayout>

Upvotes: 0

Related Questions