Radio button in android
I have an array of radio button 开发者_JS百科from where i am creating radio buttons dynamically in my layout. Here what i want, when i check one radio button then other radio buttons should be unchecked. How to manipulate this using radio button array? Please some body help!
Here is the image. Radio Buttons does not unchecked automatically.
Put all of those RadioButtons inside a RadioGroup
RadioButtons does this automatycally but you have to group them in a RadioGroup: http://developer.android.com/intl/es/reference/android/widget/RadioGroup.html
Yes, RadioButtons does this automatically. Here is the code for your reference. Hope it helps you.
<RadioButton android:id="@+id/radio_red"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Red" />
<RadioButton android:id="@+id/radio_blue"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Blue" />
精彩评论