Question

I have 4 radio buttons that i want to group in a radio group and also display each two of them in a row, i used for that LinearLayout but Radio buttons inside it seem to ignore that they are inside a RadioGroup( i wan select more than one radio button).

<RadioGroup
    android:id="@+id/radioGroup1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_alignRight="@+id/linearLayout1"
    android:layout_below="@+id/linearLayout1" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

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

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

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

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

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

</RadioGroup>

so is there any way to do that?

Was it helpful?

Solution

You are not able to have multyply selection in RadioGroup , for that you can use checkboxes or you should not be using RadioGroup

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top