【发布时间】:2021-10-04 22:03:04
【问题描述】:
如何从 RadioGroup 中选择单个项目。我分享了一个示例代码。我们将不胜感激。
<RadioGroup
android:id="@+id/gender"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:background="@drawable/custom_edit_text"
android:orientation="horizontal">
<RadioButton
android:id="@+id/male"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/male" />
<RadioButton
android:id="@+id/female"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="@string/female" />
</RadioGroup>
【问题讨论】:
标签: android