使用viewgroup的属性
android:splitMotionEvents="false"
实例代码:
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:splitMotionEvents="false"
tools:context=".SurfaceTest">
</androidx.constraintlayout.widget.ConstraintLayout>
次layout中的多个控件不能被同时按下