java当用户在安卓应用程序中更改另一个交换机时,如何更改一个交换机的状态
在我的安卓活动中,我有两个开关。我想链接两个开关,这样如果用户拖动switch1,那么switch2也应该移动,但是当拖动switch2时,它应该对switch1没有影响
科特林代码将不胜感激
多谢各位
我的XML代码
<Switch
安卓:id="@+id/switch1"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:rotation="90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Switch
安卓:id="@+id/switch2"
安卓:layout_width="wrap_content"
安卓:layout_height="wrap_content"
安卓:rotation="90"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/switch1" />
共 (0) 个答案