android-RelativeLayout实现顶部、中部、底部布局

主要使用:
设置为最顶部:android:layout_alignParentTop ="true"

设置为中部:
android:layout_above ="@+id/panelBottom"                                                android:layout_below ="@+id/panelAbove"
注意layout_above设置的是底部id,layout_below设置的是顶部id

设置为最底部:android:layout_alignParentBottom ="true" 

<?xml version="1.0" encoding= "utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto"
    xmlns:fontawesometext="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
    <!--顶部设置android:layout_alignParentTop ="true" 和 id-->
    <LinearLayout
        android:id="@+id/panelAbove"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:background="#87CEEB"
        android:orientation="horizontal" >

        <com.beardedhen.androidbootstrap.FontAwesomeText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:textSize="32sp"
            fontawesometext:fa_icon="fa-qq" />
       
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:layout_gravity="center"
             android:textColor="@color/black"
            android:text="more"           
            />
       
    </LinearLayout >
     <!--中部设置        
android:layout_above ="@+id/panelBottom"  android:layout_below ="@+id/panelAbove"
注意layout_above设置的是底部id,layout_below设置的是顶部id
-->
    <LinearLayout
        android:id="@+id/panelCenter"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_above="@+id/panelBottom"
        android:layout_below="@+id/panelAbove"
        android:orientation="vertical" >

        <com.baoyz.swipemenulistview.SwipeMenuListView
            android:id="@+id/qqlist_view"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
       
    </LinearLayout >
<!--顶部设置android:layout_alignParentBottom ="true" 和 id-->
    <LinearLayout
        android:id="@+id/panelBottom"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_gravity="center"
        android:layout_margin="1dp"
        android:background="#87CEEB"
        android:gravity="center"
        android:orientation="horizontal" >

        <com.beardedhen.androidbootstrap.BootstrapButton
            android:id="@+id/main_button_main"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:text="主页"
            bootstrapbutton:bb_icon_left="fa-home"
            bootstrapbutton:bb_roundedCorners="true"
            bootstrapbutton:bb_type="info" />

        <com.beardedhen.androidbootstrap.BootstrapButton
            android:id="@+id/main_button_add"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:text="登录"
            bootstrapbutton:bb_icon_left="fa-plus"
            bootstrapbutton:bb_roundedCorners="true"
            bootstrapbutton:bb_type="info" />

        <com.beardedhen.androidbootstrap.BootstrapButton
            android:id="@+id/main_button_exit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:text="退出"
            bootstrapbutton:bb_icon_left="fa-times"
            bootstrapbutton:bb_roundedCorners="true"
            bootstrapbutton:bb_type="info" />
    </LinearLayout >

</RelativeLayout>


  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值