如何放置相对布局在屏幕(或线性布局)的底部?布局、线性、屏幕

2023-09-05 09:34:46 作者:心既不死 梦亦不止

我有以下的XML

           

我想提出的第二线布局在屏幕的底部。 我会怎么办? 我有第二个相对布局属性设置为底部,但仍没有显示在底部。

I wanna put the second linear layout at the bottom of the screen. How will i do? I have set the property of second Relative layout to bottom but still not showing at bottom..

**

<?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>

** 感谢名单提前

** Thanx in advance

推荐答案

您想在底部应具备的布局: 安卓重力=底部 与其父应具备: 安卓layout_height =FILL_PARENT

The Layout you want at the bottom should have: android:gravity = "bottom" and its parent should have: android:layout_height="fill_parent"