【发布时间】:2020-12-20 19:35:34
【问题描述】:
我是 Android 的初学者。我正在制作一个笑话 api 应用程序,每个按钮都是类别。所以我需要获取按钮的文本内容。这是我的 xml 代码。我查看了很多线程,但都在 java 中
<Button
android:id="@+id/button3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@id/button2"
android:layout_marginTop="20dp"
android:text="science"
android:onClick="getJoke"
/>
【问题讨论】: