Android广播组和桌面布局

时间:2015-08-13 09:12:14

标签: android android-layout

我想使用表格行和广播组创建水平布局,但它总是让我们垂直。这只是半个xml

       <TableRow
            android:layout_width="fill_parent"
            android:layout_height="fill_parent">
            <RadioGroup
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentLeft="false">
                <RadioButton
                        android:layout_height="fill_parent"
                        android:layout_width="0dp"
                        android:id="@+id/food_best"
                        android:layout_gravity="center|left"
                        />
                <RadioButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        />
                <RadioButton
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        />
            </RadioGroup>

    </TableRow>

enter image description here

我相信你可能已经知道了我想要的东西。如果我将方向更改为垂直方向,它仍然是相同的。

感谢您的帮助。

根据 shaikhmanzoor 的建议进行更新 这就是它的样子

enter image description here

2 个答案:

答案 0 :(得分:0)

设置无线电组的方向,如

<RadioGroup
 android:layout_width="match_parent"
  android:layout_height="wrap_content"
 android:orientation='horizontal'>

答案 1 :(得分:-1)

您可以将方向设置为水平,它应该有效。 android:orientation="horizontal"