我已经在整个 stackoverflow 上搜索了我的问题的解决方案,但我找不到任何解决方案。我的布局文件中有一个带有 id 的按钮,我可以使用 findViewById 获取该 id。但是,当我使用 时setOnClickListener(),我不断收到相同的错误。编辑: 我尝试删除the OnClickListener()方法并创建proceedToNext()方法,但是当应用程序启动TOAST时,当我点击按钮时不显示。XML布局:<?xml version="1.0" encoding="utf-8"?><android.support.constraint.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" tools:context="com.example.enigmadx.flccounter.Main<Button android:id="@+id/btnProceed" //button id android:layout_width="142dp" android:layout_height="62dp" android:layout_marginBottom="8dp" android:layout_marginEnd="16dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:background="@color/colorPrimary" android:drawableEnd="@drawable/newarr" android:drawableRight="@drawable/newarr" android:drawableTint="@color/colorWhite" android:gravity="center" android:text="@string/proceed" android:textAlignment="inherit" android:textColor="@color/colorWhite" android:textSize="18sp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintHorizontal_bias="0.666" app:layout_constraintStart_toEndOf="@+id/textView" app:layout_constraintTop_toTopOf="parent" app:layout_constraintVertical_bias="0.923" tools:targetApi="m" android:layout_marginRight="16dp" android:layout_marginLeft="8dp" />
添加回答
举报
0/150
提交
取消