Android Wing of mucchin | RadioButton related



How to deploy a group of (RadioButton) more than one radio button


I want to place a group of (RadioButton) more than one radio button, can I do?

Android app, compared with application forms and Web site of PC, the screen is small.
So, things like that, to put the radio button to choose a combination of A, either B, a combination of radio buttons to choose C, D either may not so much.
Should I use Jean Spinner · · ·.
I think.
But, there may be times when you called, you want to implement in the RadioButton absolutely.
So, I will show you how to place a combination of more than one RadioButton.


Aside a little in front of it.
I, first, in Android, there is no pull-down menu? Was thought.
Because there was no feeling that View the name of "PullDown" or, "ComboBox" reason.
No way, and is named Spinner ·.
Android Beginners I did not know that yet for the existence of Spinner, we consider using the RadioButton.
So, this article is the information in my own way at that time were investigated.


To say that were examined,
XML layout to Android, I noticed when you add the RadioButton.
Below is the window of when you add to the XML View of the layout.
How to deploy a group of (RadioButton) more than one radio button
Please look at the red frame part.
There are ViewGroup named, indeed.
"RadioGroup" even its name.
Use the right guy.
This RadioGroup, as well as such ViewGroup LinearLayout, can have a View to child elements.
As noted near the beginning, if you want to place the radio button to choose a combination of A, either B, a combination of radio buttons to choose C, either D is as follows: if OK.




Will be as follows: In the XML of the layout.
<RadioGroup Android:id="@+id/RadioGroup01" android:layout_width="wrap_content" android:layout_height="wrap_content">
<RadioButton Android:id="@+id/RadioButton01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="A"> </ RadioButton>
<RadioButton Android:id="@+id/RadioButton02" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="B"> </ RadioButton>
</ RadioGroup>
<RadioGroup Android:id="@+id/RadioGroup02" android:layout_width="wrap_content" android:layout_height="wrap_content">
<RadioButton Android:id="@+id/RadioButton03" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="C"> </ RadioButton>
<RadioButton Android:id="@+id/RadioButton04" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="D"> </ RadioButton>
</ RadioGroup>


Seen in the window and feel Outline Android Layout Editor for Eclipse is as follows. So as to become a red frame, it is OK if you add a View.
How to deploy a group of (RadioButton) more than one radio button


And for this to work, as follows: to give you a choice of one by one from each C A, and B, D.
How to deploy a group of (RadioButton) more than one radio button