如何将相对布局放置在屏幕底部(或线性布局)。
我有以下的XML
我想将第二个线性布局放在屏幕的底部。 我将如何做? 我已将第二个相对布局的属性设置为底部,但仍未显示在底部。
**
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent">    
<RelativeLayout android:id="@+id/RelativeLayout01" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content">   
</RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayout02" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content">   
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" 
    android:layout_width="fill_parent"
    android:layout_gravity="bottom">
</RelativeLayout>
</LinearLayout>
**提前感谢
  你想在底部的布局应该有: 
 android:gravity = "bottom" 
  其母公司应该拥有: 
 android:layout_height="fill_parent" 
我也在寻找这一点。 我刚刚找到的解决方案是使用该属性:
android:layout_alignParentBottom="true"
  而不是你现有的android:layout_gravity="bottom" 
  这不幸的是,与我的布局只有当有一个额外的RelativeLayout作为根布局和其余添加到它的作品。  也许情况并非总是如此,但通过使用LinearLayout (即使在被告知使用fill_parent ),它只使用所有需要添加的元素的高度,并将页脚放置在底部。 
我来到这个解决方案,看着这个相关的问题:我如何使用RelativeLayout实现以下结果?
在这里编辑,因为答案评论中的格式丢失了:你的意思是你不能重写它或它不工作?
我也有一个垂直LinearLayout,我的新xml结构看起来(没有布局大小参数等)。 喜欢这个:
<RelativeLayout>
    <RelativeLayout 
        android:id="@+id/RelativeLayout01">
    </RelativeLayout>
    <RelativeLayout 
        android:id="@+id/RelativeLayout02" 
        android:layout_below="@+id/RelativeLayout01">   
    </RelativeLayout>
    <RelativeLayout 
        android:layout_below="@+id/RelativeLayout02" 
        android:layout_alignParentBottom="true">
    </RelativeLayout>
</RelativeLayout>
您应该在重量为1的最后一个布局之前放置一个视图,并将其放到底部。 喜欢这个:
    <View android:id="@+id/emptySpace"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    />
上一篇: How to place Relative layout at bottom of screen(or linear layout).?
