デフォルトで1つのRadioButtonがチェックされた状態で、AndroidでRadioGroupを構築しようとしています。プログラムではなく、XML を使用してこれを行うことができるかどうか疑問に思っています。
エラーが発生しているため、次のコード スニペットは機能していないようです。
error: Error: No resource found that matches the given name (at 'checkedButton' with value '@id/rdb_positive')
コードは次のとおりです。
<RadioGroup
style="@style/FormInputField"
android:orientation="vertical"
android:checkedButton="@id/rdb_positive"> <!-- Error on this line -->
<RadioButton
android:id="@+id/rdb_positive"
android:text="@string/answer_positive" />
<RadioButton
android:id="@+id/rdb_negative"
android:text="@string/answer_negative" />
</RadioGroup>
RadioGroup の属性が設定された後に RadioButton の id が定義されるので、ある意味では理にかなっていますが、なぜそのような属性が利用できるのだろうかと思います。