为什么我不能通过相对布局获得此设置?

Why can't I get this setup with a relative layout?

我正在编写一个 android 应用程序,我希望在其中有一个 table 顶部、底部列表和同一屏幕上的一些按钮。它有点忙,但这是我的设置。问题是,我不知道如何让这个布局正确,这样一切都不会相互重叠。我在 android 工作室试过每一个。

这是我想要的样子:

(大家被我的画功给折服了):

对我来说,相对布局最有意义。但是,每当我添加 gridview 时,我都无法使其底部与屏幕中心对齐。例如,它只是在设计器中接管:

我的问题是:有没有办法做到这一点?顶部项目不需要可点击,但我确实需要动态创建行和列并使其看起来像 table。因此,它可以是另一个控件。

如果我正确理解你的问题,你正在尝试按照右下方的图像快照中显示的那样做?


这是该结构的 xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@android:color/darker_gray"
        android:orientation="vertical" >

        <GridView
            android:id="@+id/gridView1"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:numColumns="3" >
        </GridView>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:background="@android:color/black"
        android:orientation="horizontal" >

        <ListView
            android:id="@+id/listView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="#D7DF01"
            android:layout_weight="1" >
        </ListView>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:background="#DF01A5"
            android:orientation="vertical" >

            <Button
                android:id="@+id/button1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button" />

            <Button
                android:id="@+id/button2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Button" />
        </LinearLayout>
    </LinearLayout>

</LinearLayout>

希望对您有所帮助!