私の Android アプリケーションでは、xml レイアウトでラジオ グループを無効にする必要があります。私は検索しましたが、xmlレイアウトではなく、プログラムでしか見つけられませんでした。
私のコードはここにあります
<RadioGroup
android:id="@+id/menu1"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:layout_x="170dp"
android:layout_y="100dp" >
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Yes" />
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="No" />
</RadioGroup>
android:enabled="false" を試してみましたが、Radio Group ではサポートされていません。しかし、RadioButton では次のように機能します。
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:enabled="false"
android:text="Yes" />
ここで私の質問は、RadioGroup に 10 個の RadioButton が含まれている場合、個々の RadioButton ごとではなく、RadioGroup に対してのみ enable=false を設定したいということです。では、RadioButton を無効にする代わりに、RadioGroup 全体を無効にするにはどうすればよいでしょうか。
私はxmlレイアウトでのみ必要です。前もって感謝します