Java 特定按钮拒绝在Android Studio中工作
我有两个按钮,似乎有相同的功能。当我将“switchMode”方法放在“buttonMode”中时,它不起作用。但当我把“开关模式”放在“按钮背景灯”中时,它工作正常,尽管我没有改变任何东西 以下是按钮:Java 特定按钮拒绝在Android Studio中工作,java,android,Java,Android,我有两个按钮,似乎有相同的功能。当我将“switchMode”方法放在“buttonMode”中时,它不起作用。但当我把“开关模式”放在“按钮背景灯”中时,它工作正常,尽管我没有改变任何东西 以下是按钮: <Button android:id="@+id/buttonMode" android:layout_width="50dp" android:layout_height="50dp" android:background="@android:color
<Button
android:id="@+id/buttonMode"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@android:color/transparent"
android:onClick="switchMode"
android:soundEffectsEnabled="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.584" />
<Button
android:id="@+id/buttonBackLight"
android:layout_width="50dp"
android:layout_height="50dp"
android:background="@android:color/transparent"
android:soundEffectsEnabled="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.399" />
这些按钮使用的是什么布局?ConstraintLayout。项目本身模拟了数字手表,它有三个按钮。你在布局上看到两个按钮了吗?尝试更改那些
按钮的文本,然后再次签出。我在布局上看到两个按钮。它们根本不包含文本。我尝试将buttonMode放在不同的位置,但仍然无法使用两个按钮的click register粘贴java代码
public void switchMode(View view) {
if(mainScreenViewsAreVisible) {
twentyFourHoursFormat = !twentyFourHoursFormat;
swapTimeFormatVisibility();
}
if(stopWatchViewsAreVisible){
isRunning = true;
}
}