Android RadioGroup checkedButton property

dvvivat

New Member
I am trying to build RadioGroup in Android with one RadioButton checked by default. I'm wondering if this is possible to do through xml, rather than programmatically.The following code snippet doesn't seem to work as I'm getting an errorerror: Error: No resource found that matches the given name (at 'checkedButton' with value '@id/rdb_positive').\[code\]<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>\[/code\]It does make sense in a way, as the id of the RadioButton is defined after the attribute in the RadioGroup is set, but then I wonder why there is such attribute available.Any help is greatly appreciatedThanks beforehand
 
Back
Top