The radio button is a simple customizable RadioButton UI element. The following images show some examples:
You need to create a new com.att.widget.RadioButton object and add it to your view or layout.
<?xml version="1.0" encoding="UTF-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <TextView android:id="@+id/textFieldAndroid" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="This is a Radio Button Example." android:paddingBottom="10dp"/> <RadioGroup android:id="@+id/radioGroup" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_below="@id/textFieldAndroid"> <com.att.widgets.lib.button.RadioButton android:id="@+id/radioButton" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Radio Button 1" android:layout_below="@+id/radioGroup"/> <com.att.widgets.lib.button.RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Radio Button 2" android:layout_below="@+id/radioButton"/> <com.att.widgets.lib.button.RadioButton android:id="@+id/radioButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/radioButton" android:text="Radio Button 3 enabled and focusable = false" android:focusable="false" android:enabled="false"/> </RadioGroup> </RelativeLayout>
You must group your RadioButton instances into RadioGroup tag in order to get them working together.
<?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioGroup android:id="@+id/radioGroup" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <!-- Radio Button instances. --> </RadioGroup> </LinearLayout>
<com.att.widgets.lib.button.RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Radio Button 2" />
<com.att.widgets.lib.button.RadioButton android:id="@+id/radioButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Radio Button 3 enabled and focusable = false" android:focusable="false" android:enabled="false"/>