Disable multi finger touch in my app [duplicate]

For case: you have multiple buttons and you want make selected only one button. In parent (NOT ROOT, just parent of child) of buttons, in its xml params add

android:splitMotionEvents=”false”

And that’s it.
Example:

<LinearLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:splitMotionEvents="false" <-----------!!!
    >

    <Button
    android:id="@+id/button_main_1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="button1" />

    <Button
    android:id="@+id/button_main_2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="button2" />

    <Button
    android:id="@+id/button_main_3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="button3" />
</LinearLayout>

Btw. When you have 2 linearlayout with 3 buttons per layout, you should set this splitMotionEvents in that two layouts and also in parent of that 2 linearLayouts. Otherwise you will be able click only one button per layout (sum = 2 then). I hope you get it. 🙂

None of the other solutions didn’t work for me or was too lame.

Leave a Comment