Search code examples
androidmulti-touchandroid-9.0-pie

How to disable multi touch with Android P?


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?


Solution

  • 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);
    }