Подтвердить что ты не робот

Есть ли способ расположить радиогруппу горизонтально?

У меня есть две радиокнопки внутри группы радио. Прямо сейчас они выстроились вертикально. Я попытался поместить их в горизонтальный контейнер, но это не помогло.

Есть ли способ получить группу радиостанций для выравнивания по горизонтали?

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >

<RadioGroup
    android:id="@+id/radioSex"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <RadioButton
        android:id="@+id/radioChats"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Chats" 
        android:checked="true" />

    <RadioButton
        android:id="@+id/radioPlayers"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Players" 
        android:checked="true" />

    </RadioGroup>

<Button android:text="Home" 
    android:id="@+id/buthome"
     android:paddingTop="-15dip"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" />

    <Button android:text="Players" 
       android:id="@+id/butplayers"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" />

  <TextView 
        android:id="@+id/viewActivePlayer" 
      android:layout_width="wrap_content" 
         android:layout_height="wrap_content"
      android:text="TedP" 
      android:layout_gravity="right" 
         android:textColor="#fffff109"
    android:textSize="26dip" />    

4b9b3361

Ответ 1

Добавить android: orientation = 'horizontal' в тег RadioGroup:

<RadioGroup
   android:id="@+id/radioSex"
   android:layout_width="wrap_content"
   android:layout_height="wrap_content" 
   android:orientation='horizontal'>

Ответ 2

Вы также можете установить это программно:

myRadioGroup.setOrientation(LinearLayout.HORIZONTAL);