的Android布局与2个均匀间隔开的按钮
-
25-09-2019 - |
题
我有这样的布局,与文本视图正常工作,相对布局和两个按钮均匀隔开在其下方。
<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>
但是运行layoutopt它说,“此布局的TableRow或其TableLayout父是可能无用的”。
有没有办法做到这一点的布局则没有表?
解决方案
转储TableLayout
和TableRow
,和只是使用一个水平LinearLayout
在自己的位置。 “魔术师”是在你的0dip
宽度和重量1
,你已经有了。
不隶属于 StackOverflow