android复杂布局示例

本文详细介绍了如何使用XML来构建Android应用的界面布局,包括头部、底部和中部的结构设计,以及颜色、文本等样式的应用。通过实例展示了如何在Android应用中实现灵活且美观的界面设计。
<?xml version="1.0" encoding="UTF-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id
="@+id/RelativeLayout_bg" android:layout_width="fill_parent"
android:layout_height
="fill_parent">
<!-- 头部 -->
<RelativeLayout
android:id="@+id/RelativeLayout_top"
android:orientation
="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="50dp"
android:layout_alignParentTop
="true"
android:gravity
="center">
<TextView
android:id="@+id/view_top"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:textColor
="#FF00ff00"
android:text
="顶部标题" />
</RelativeLayout>
<!-- 底部 -->
<RelativeLayout
android:id="@+id/RelativeLayout_bottom"
android:orientation
="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="50dp"
android:layout_alignParentBottom
="true"
android:gravity
="center">
<Button
android:id="@+id/Button_goMain"
android:text
="底部按钮"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content" />
</RelativeLayout>
<!-- 中部 -->
<LinearLayout
android:orientation="horizontal"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
android:layout_above
="@id/RelativeLayout_bottom"
android:layout_below
="@+id/RelativeLayout_top">
<!-- 中部左侧栏 -->
<RelativeLayout
android:id="@+id/RelativeLayout_middleleft"
android:orientation
="vertical"
android:layout_width
="200dp"
android:layout_height
="fill_parent"
android:background
="#1d2152"
android:layout_alignParentLeft
="true"
android:gravity
="center">
<TextView
android:id="@+id/view_middleleft"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:textColor
="#FF00cc00"
android:text
="左侧标题 " />
</RelativeLayout>
<!-- 中部主框架 -->
<LinearLayout
android:orientation="vertical"
android:layout_width
="fill_parent"
android:layout_height
="fill_parent"
android:background
="#eeccee"
android:gravity
="center"
android:layout_toRightOf
="@id/RelativeLayout_middleleft">
<TextView
android:id="@+id/view_middle_area"
android:layout_width
="wrap_content"
android:layout_height
="wrap_content"
android:textColor
="#000066"
android:text
="主面板标题" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>

  实际显示效果如下:

转载于:https://www.cnblogs.com/meetrice/archive/2011/08/29/2158224.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值