добавить радиокнопки внутри LinearLayout в RadioGroup

У меня есть 4 радиокнопки, которые я хочу сгруппировать в радиогруппу, а также отображать каждую из них в строке, я использовал для этого LinearLayout, но радиокнопки внутри него, кажется, игнорируют, что они находятся внутри RadioGroup (я хочу выбрать больше, чем один переключатель).

<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>

так есть ли способ сделать это?


person choco    schedule 23.04.2014    source источник
comment
Вам не нужен внешний LinearLayout, поскольку RadioGroup LinearLayout.   -  person CommonsWare    schedule 24.04.2014


Ответы (1)


Вы не можете иметь возможность множественного выбора в RadioGroup, для этого вы можете использовать флажки, или вам не следует использовать RadioGroup

person Hubert Liberacki    schedule 23.04.2014