Android:placing the radio buttons horizontally

To place a radiogroup (or any other view) above other just do:

android:layout_above="@+id/view_below"

To change the orientation just set:

android:orientation="horizontal"

And to give equal width to items make use of layout_weight:

<RadioGroup
    android:id="@+id/radio_group"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:layout_above="@+id/view_below" >

    <RadioButton
        android:id="@+id/radio1"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:checked="true"
        android:text="First" />

    <RadioButton
        android:id="@+id/radio2"
        android:layout_width="0dp"
        android:layout_weight="1"
        android:layout_height="wrap_content"
        android:text="Second" />
</RadioGroup>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)