Radio group with radio objects inside the relative Android scheme

I want to create a simple layout, for example:

(o) Radio button A (o) Radio button B [textedit] [x] checkbox 

To do this, I created the following layout.xml:

 <RadioGroup android:layout_above="@+id/RadioButton_Count" android:id="@+id/RadioGroup01" android:layout_height="wrap_content" android:layout_width="fill_parent"> <RadioButton android:layout_height="wrap_content" android:id="@+id/RadioButton_A" android:text="Play forever" android:checked="true" android:layout_width="fill_parent" android:textSize="20sp"> </RadioButton> <RelativeLayout android:id="@+id/RelativeLayout01" android:layout_width="wrap_content" android:layout_height="wrap_content"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/RadioButton_B" android:text="Count:" android:textSize="20sp"> </RadioButton> <EditText android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/EditText_NumCount" android:inputType="number" android:layout_toRightOf="@+id/RadioButton_B" android:width="70sp" > </EditText> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/CheckBox_StopCount" android:text="Stop" android:layout_below="@+id/RadioButton_B" android:textSize="18sp"> </CheckBox> </RelativeLayout> </RadioGroup> 

It looks correct, but the problem is that the radio objects are not connected, I mean that they can be turned on at the same time. I think that because even if they hang from the same one, the second is inside another layout: \ Does anyone know how I can make such a layout (mainly [textedit] just right, RadioButton B), getting a job and hams? Many thanks

+4
source share
2 answers

The first thing to try is to close your RadioGroup immediately after closing the last RadioButton, and not at the end. The best solution is to use RelativeLayout as a shared container. Then add your radio group and both buttons and close the group. Add other elements relative to the rest of the layout.

0
source

You just can't do it. I also tried to do something similar and got stuck.

"RadioButtons must be direct children of RadioGroup." https://code.google.com/p/android/issues/detail?id=1214

+6
source

All Articles