android - 如何防止用户同时按下两个按钮?

标签 android android-layout android-button

在我的应用程序的每个 Activity 中,用户都可以同时按下两个按钮。 我怎样才能阻止他们这样做?

最佳答案

you can disable the multi touch in the screen...which can allow only single touch by

place this line button viewGroup layout

android:splitMotionEvents="false"

<LinearLayout
        android:id="@+id/list_layout"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        android:splitMotionEvents="false" >

        <Button
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:scrollbars="none" >
        </Button>

        <Button
            android:id="@+id/listView2"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:scrollbars="none" >
        </Button>
    </LinearLayout>

关于android - 如何防止用户同时按下两个按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22198843/

相关文章:

android - 良好的 Android UI 设计模式引用

Android:在 RelativeLayout 中将所有 View 以一个 View 居中

Android - 如何使按钮文本闪烁/闪烁?

java - onclick 监听器在片段中不起作用

java - 当设备处于 sleep 状态时在后台运行广播接收器?

android - 用于发布 web 服务的主体的名称是什么

Android AppCompatCheckbox 填充/边距/重力

android - 对 Activity 的 onCreate() 的长时间操作

java - 自动生成代码并出现错误

android - 如何使 Android 中的 Material 切换按钮表现得像 Switch?