【Android】ラジオグループ
スポンサーリンク
ラジオボタンを複数配置してもそれぞれ独立した選択となってしまいます。
これをグループ扱いとしていずれか1つしか選択できないようにする方法のメモ。
<RadioGroup android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentStart="true"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New RadioButton" android:id="@+id/radioButton" android:checked="false" /> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="New RadioButton" android:id="@+id/radioButton2" android:checked="false" /> </RadioGroup>