Android布局有2个均匀间隔的按钮

Rob*_*ond 7 android android-layout

我有这个布局正常工作,相对布局与文本视图和两个按钮均匀分布在它下面.

<RelativeLayout android:id="@+id/entrypopup"
            android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:padding="5px"
    android:visibility="gone"
    android:layout_below="@+id/ad"
    android:background="#80000000">
    <TextView android:id="@+id/title" android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:text="Entry Popup..."
        android:textColor="#ffffffff"
        android:textSize="20sp" />
    <TableLayout android:id="@+id/TableLayout01"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:layout_below="@id/title">
        <TableRow android:layout_weight="1">
            <Button android:id="@+id/buttonVisit" android:text="View"
                android:layout_height="fill_parent"
                android:layout_width="0dip"
                android:layout_weight="1"/>
            <Button android:id="@+id/buttonCancel" android:text="Cancel"
                android:layout_width="0dip"
                android:layout_weight="1" 
                android:layout_height="fill_parent"/>
        </TableRow>
    </TableLayout>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

但是运行layoutopt它说"这个TableRow布局或其TableLayout父级可能无用".

有没有办法在没有表格的情况下进行此布局?

Com*_*are 11

转储TableLayoutTableRow,并LinearLayout在他们的位置使用水平."魔法"在你的0dip宽度和1重量上,你已经拥有了.