Monday, July 13, 2015

android: how to add radio button group

Use this code in Xml  file

<RadioGroup
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <RadioButton
            android:id="@+id/radioButton19"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="" />

        <RadioButton
            android:id="@+id/radioButton20"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="" />
    </RadioGroup>
If you want to default select a button then use bellow  option
   <RadioButton
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:typeface="serif"
                android:id="@+id/pre_paid"
                android:text="@string/Prepaid"
                android:checked="true"
                android:layout_weight="0.10" />

No comments:

Post a Comment