Android 为什么可以';我不能用一个相对的布局来进行设置吗?
我正在写一个android应用程序,我想在上面有一张桌子,在底部有一个列表,在同一个屏幕上有一些按钮。有点忙,但这是我的安排。问题是,我不知道如何使这个布局正确,这样所有的东西都不会互相重叠。我已经在android studio中试过了 以下是我希望它看起来的样子: (每个人都对我的绘画技巧印象深刻): 对我来说,相对布局最有意义。但是,每当我添加gridview时,我都无法使它的底部与屏幕的中心对齐。例如,它只是在设计器中接管: 我的问题是:有没有办法做到这一点?顶部的项目不需要是可点击的,但我需要动态创建行和列,并使其看起来像一个表。因此,它可以是另一个控件 如果我正确理解了您的问题,您是否正试图按照右下方的图像快照所示进行操作?Android 为什么可以';我不能用一个相对的布局来进行设置吗?,android,layout,Android,Layout,我正在写一个android应用程序,我想在上面有一张桌子,在底部有一个列表,在同一个屏幕上有一些按钮。有点忙,但这是我的安排。问题是,我不知道如何使这个布局正确,这样所有的东西都不会互相重叠。我已经在android studio中试过了 以下是我希望它看起来的样子: (每个人都对我的绘画技巧印象深刻): 对我来说,相对布局最有意义。但是,每当我添加gridview时,我都无法使它的底部与屏幕的中心对齐。例如,它只是在设计器中接管: 我的问题是:有没有办法做到这一点?顶部的项目不需要是可点击的
下面是该结构的xml
希望能有所帮助请发布您的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>