【发布时间】:2012-03-03 11:54:40
【问题描述】:
有没有更好的方法来做到这一点,使按钮在屏幕两侧底部对齐?重要的部分是 alignParentBottom,它似乎只在 RelativeLayout 中可用,以及 layout_gravity,它似乎只在 LinearLayout 及其子类(如 TableLayout)中可用,RelativeLayout 不是其中之一。
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="1">
<TableRow>
<Button
android:id="@+id/list_delete"
android:text="@string/list_delete"
android:visibility="invisible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<Button
android:id="@+id/list_save"
android:text="@string/list_add"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
Android lint 给我这样的错误:
- 这个 TableLayout 布局或者它的 RelativeLayout 父级是没用的
- 此 TableRow 布局或其 TableLayout 父级无用
【问题讨论】: