How to disable multi touch with Android P?

3.1k Views Asked by At

Add the following code in theme.xml and refer it with android:theme attribute on AndroidManifest.xml.

<item name="android:splitMotionEvents">false</item>
<item name="android:windowEnableSplitTouch">false</item>

And it works well below Android P.

Unfortunately, it does't work on some devices running with Android 9.0.

Guys, how can I figure it out?

2

There are 2 best solutions below

1
On BEST ANSWER

I have tried to override dispatchTouchEvent on my Activity as a plan B.

In fact, it works indeed. Although it may cause some bugs somehow.

@Override
public boolean dispatchTouchEvent(MotionEvent ev) {
    return ev.getPointerCount() == 1 && super.dispatchTouchEvent(ev);
}
2
On

I faced the same issue. But if you need to disable multitouch per view (e.g. for a recycerview) you can use android:splitMotionEvents="false" inside your layout. Working fine with Android P.