2017-07-01 3 views

答えて

1

私はあなたが、初心者によって頻繁に起こる、有効にされたという意味を誤解していると思います。 android:enabled="true"は、RadioButtonが使用可能であることを意味します。たとえば、有効になっていないRadioButtonは、ユーザーのクリックに反応しません。何が必要checkedです:

android:checked="true" 

チェックアウトドキュメント:https://developer.android.com/guide/topics/ui/controls/radiobutton.html https://developer.android.com/reference/android/widget/RadioButton.html

0

それはですしてみてください!

<RadioButton 
    android:id="@+id/radioButton" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:checked="true" 
    android:text="RadioButton" /> 

変更:

android:enabled="true" 

のために:

RadioButton b = (RadioButton) findViewById(R.id.option1); 
b.setChecked(true); 

私はこの意志を願っています:プログラムで

android:checked="true" 
0

、あなたがチェック可能なインタフェースで定義されたsetCheckedメソッドを使用することができますお手伝いしましょう。

0

代わりの

android:enabled="true" 

この

android:checked="true" 
を使用します
関連する問題