【发布时间】:2018-09-18 12:14:18
【问题描述】:
我使用两个线性布局来显示两行单选按钮 3 在一行中,3 在另一行中。我搜索发现应该使用radio group。但是在使用单选组后,当我选择单选按钮时,我也无法取消选中单选按钮
<RadioGroup
android:id="@+id/payment_mode"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="18dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
style="@style/LinkButton"
android:id="@+id/cash"
android:text="CASH" />
<RadioButton
style="@style/LinkButton"
android:id="@+id/card"
android:text="CARD" />
<RadioButton
style="@style/LinkButton"
android:id="@+id/pay_tm"
android:text="PAYTM" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<RadioButton
style="@style/LinkButton"
android:id="@+id/bank"
android:text="BANK" />
<RadioButton
style="@style/LinkButton"
android:id="@+id/cc_av"
android:text="CC-AV" />
<RadioButton
style="@style/LinkButton"
android:id="@+id/credit"
android:text="CREDIT" />
</LinearLayout>
</RadioGroup>
【问题讨论】:
-
请添加您的代码
标签: android xml radio-button radio-group