我定义了以下Android布局......
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:p1="http://schemas.android.com/apk/res/android"
p1:orientation="vertical"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:minWidth="25px"
p1:minHeight="25px">
<TableLayout
p1:minWidth="25px"
p1:minHeight="25px"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:id="@+id/tableLayout1">
<TableRow
p1:layout_weight="1"
p1:id="@+id/tableRow1"
p1:minWidth="25px"
p1:minHeight="25px">
<TextView
p1:text="Small Text"
p1:textAppearance="?android:attr/textAppearanceSmall"
p1:layout_width="match_parent"
p1:layout_height="match_parent"
p1:layout_column="0"
p1:id="@+id/textView1" />
</TableRow>
<TableRow
p1:layout_weight="1"
p1:id="@+id/tableRow2"
p1:minWidth="25px"
p1:minHeight="25px">
</TableRow>
<TableRow
p1:layout_weight="1"
p1:id="@+id/tableRow3"
p1:minWidth="25px"
p1:minHeight="25px">
<Button
p1:text="Button"
p1:layout_column="0"
p1:id="@+id/button1"
p1:layout_width="match_parent"
p1:layout_height="50dp" />
</TableRow>
</TableLayout>
</FrameLayout>
导致......
这就是我需要做的......
如何更改布局xml以实现此目的?
答案 0 :(得分:1)
我不明白为什么你想要表和行所以我提供其他解决方案,其中RelativeLayout和根据Android文档是最好的容器使用。
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentTop="true"
android:id="@+id/textView"
android:text="text"
android:background="#f0f" />
<LinearLayout
android:layout_width="match_parent"
android:background="#0ff"
android:orientation="vertical"
android:layout_below="@+id/textView"
android:layout_above="@+id/button"
android:layout_height="fill_parent">
<!--put whenever you want in here-->
</LinearLayout>
<Button
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="100dp"
android:id="@+id/button"
android:text="button"
android:background="#ff0"/>
</RelativeLayout>