• 相对嵌套布局


    下面是软件运行时的界面:


    xml代码如下

      1. <?xml version="1.0" encoding="UTF-8"?>  
      2. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"  
      3.     android:id="@+id/RelativeLayout_bg" android:layout_width="fill_parent"  
      4.     android:layout_height="fill_parent">  
      5.     <!-- 头部 -->  
      6.     <RelativeLayout   
      7.         android:id="@+id/MyLayout_top"  
      8.         android:orientation="horizontal"   
      9.         android:layout_width="fill_parent"  
      10.         android:layout_height="20dp"   
      11.         android:layout_alignParentTop="true"  
      12.         android:gravity="center">  
      13.         <TextView  
      14.             android:id="@+id/view_top"   
      15.             android:layout_width="wrap_content"  
      16.             android:layout_height="wrap_content"   
      17.             android:textColor="#FF00ff00"   
      18.             android:text="顶部标题"  />  
      19.     </RelativeLayout>  
      20.     <!-- 底部 -->  
      21.     <RelativeLayout   
      22.         android:id="@+id/MyLayout_bottom"  
      23.         android:orientation="horizontal"   
      24.         android:layout_width="fill_parent"  
      25.         android:layout_height="40dp"   
      26.         android:layout_alignParentBottom="true"  
      27.         android:gravity="center">  
      28.         <Button   
      29.             android:id="@+id/Button_goMain"   
      30.             android:text="底部按钮"  
      31.             android:layout_width="wrap_content"   
      32.             android:layout_height="wrap_content" />  
      33.     </RelativeLayout>  
      34.     <!-- 中部 -->  
      35.     <RelativeLayout   
      36.         android:orientation="horizontal"  
      37.         android:layout_width="fill_parent"   
      38.         android:layout_height="fill_parent"  
      39.         android:layout_above="@id/MyLayout_bottom"   
      40.         android:layout_below="@id/MyLayout_top">  
      41.             <!-- 中部左侧栏 -->  
      42.             <LinearLayout  
      43.             android:id="@+id/MyLayout_middleleft"  
      44.             android:orientation="vertical"   
      45.             android:layout_width="60dp"  
      46.             android:layout_height="fill_parent"   
      47.             android:background="#1d2152"  
      48.             android:layout_alignParentLeft="true"  
      49.             android:gravity="center">  
      50.                     <TextView  
      51.                         android:id="@+id/view_middleleft"   
      52.                         android:layout_width="wrap_content"  
      53.                         android:layout_height="wrap_content"   
      54.                         android:textColor="#FF00cc00"   
      55.                         android:text="左侧标题         "  />  
      56.             </LinearLayout>  
      57.             <!-- 中部主框架 -->  
      58.             <LinearLayout   
      59.             android:id="@+id/LinearLayoutMiddle"  
      60.             android:orientation="vertical"  
      61.             android:layout_width="fill_parent"   
      62.             android:layout_height="fill_parent"  
      63.             android:background="#eeccee"  
      64.             android:gravity="center"  
      65.             android:layout_toRightOf="@id/MyLayout_middleleft">  
      66.                     <TextView   
      67.                     android:id="@+id/view_middle_area"   
      68.                     android:layout_width="wrap_content"  
      69.                     android:layout_height="wrap_content"   
      70.                     android:textColor="#000066"   
      71.                     android:text="主面板标题" />  
      72.             </LinearLayout>  
      73.             <!-- 中部右侧栏 -->  
      74.             <LinearLayout  
      75.             android:orientation="vertical"  
      76.             android:layout_width="60dp"  
      77.             android:layout_height="fill_parent"  
      78.             android:background="#1d2152"  
      79.             android:layout_alignParentRight="true"  
      80.             android:gravity="center">  
      81.                     <TextView   
      82.                     android:id="@+id/view_middle_right_area"   
      83.                     android:layout_width="wrap_content"  
      84.                     android:layout_height="wrap_content"   
      85.                     android:textColor="#000066"   
      86.                     android:text="右标题" />  
      87.             </LinearLayout>  
      88.     </RelativeLayout>  
      89. </RelativeLayout> 
  • 相关阅读:
    [GIT] warning: LF will be replaced by CRLF问题解决方法
    最近想学的工具
    如何在webstrom中配置eslint和less
    Git常用命令
    windows下nginx安装、配置与使用
    关于 addEventListener 和 handleEvent 方法
    PHP中的魔术方法总结 :__construct, __destruct , __call, __callStatic,__get, __set, __isset, __unset , __sleep, __wakeup, __toStr
    Git使用详细教程
    9个永恒的UI设计原则
    常见浏览器兼容性问题与解决方案
  • 原文地址:https://www.cnblogs.com/stephen-init/p/3516577.html
Copyright © 2020-2023  润新知