xml代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--上半部分-->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="120dp"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:id="@+id/relativeLayoutTop">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#cccccc">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="上半部分"
android:textColor="#FFFFFF"
android:textSize="20dp"
android:gravity="center_horizontal" />
</LinearLayout>
</RelativeLayout>
<!--下半部分-->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:id="@+id/relativeLayoutBottom">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="#888888">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="下半部分"
android:textColor="#000000"
android:textSize="20dp"
android:gravity="center_horizontal" />
</LinearLayout>
</RelativeLayout>
<!--中间部分-->
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/relativeLayoutTop"
android:id="@+id/relativeLayoutCenter"
android:layout_above="@id/relativeLayoutBottom">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ffffff">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="中间部分"
android:textColor="#000000"
android:textSize="20dp"
android:gravity="center_horizontal" />
</LinearLayout>
</HorizontalScrollView>
</RelativeLayout>
</RelativeLayout>

效果图:

RelativeLayout 中主要属性

android:layout_above="@id/xxx"        –将控件置于给定ID控件之上
android:layout_below="@id/xxx"        –将控件置于给定ID控件之下

android:layout_toLeftOf="@id/xxx"          –将控件的右边缘和给定ID控件的左边缘对齐
android:layout_toRightOf="@id/xxx"       –将控件的左边缘和给定ID控件的右边缘对齐

android:layout_alignLeft="@id/xxx"                  –将控件的左边缘和给定ID控件的左边缘对齐
android:layout_alignTop="@id/xxx"                  –将控件的上边缘和给定ID控件的上边缘对齐
android:layout_alignRight="@id/xxx"               –将控件的右边缘和给定ID控件的右边缘对齐
android:layout_alignBottom="@id/xxx"            –将控件的底边缘和给定ID控件的底边缘对齐
android:layout_alignParentLeft="true"              –将控件的左边缘和父控件的左边缘对齐
android:layout_alignParentTop="true"              –将控件的上边缘和父控件的上边缘对齐
android:layout_alignParentRight="true"            –将控件的右边缘和父控件的右边缘对齐
android:layout_alignParentBottom="true"         –将控件的底边缘和父控件的底边缘对齐
android:layout_centerInParent="true"               –将控件置于父控件的中心位置
android:layout_centerHorizontal="true"            –将控件置于水平方向的中心位置
android:layout_centerVertical="true"                –将控件置于垂直方向的中心位置

参考:https://blog.csdn.net/afanyusong/article/details/44221595

Xamarin.Android 上中下布局的更多相关文章

  1. HTML——上中下布局

    上中下布局是最主要的布局方式,本比如果用户屏幕分辨率为800*600像素. watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc3Vuc2h1bWlu/font ...

  2. div上中下布局中间自适应

    需求1: 头尾固定高度,中间自适应 1.上部(header)Div高度固定100px,宽度100%: 2.下部(footer)Div高度固定100px,宽度100%: 3.中部(middle)DIV高 ...

  3. Xamarin.Android之简单的抽屉布局

    0x01 前言 相信对于用过Android版QQ的,应该都不会陌生它那个向右滑动的菜单(虽说我用的是Lumia) 今天就用Xamarin.Android实现个比较简单的抽屉布局.下面直接进正题. 0x ...

  4. [置顶] xamarin android 布局尺寸了解

    为了使UI界面在不同大小的移动端显示器上能够正常显示,大家可能都知道使用sp作为字体大小的单位,dp作为其他元素长度的单位. 前几天看了一篇文章关于 App设计规范的,文章用心写的非常好,这里是链接  ...

  5. Xamarin.Android之布局文件智能提示问题

    一.前言 看到有人问关于xamarin.android的布局没智能提示问题(VS 2015),当然,写布局这东西没提示这是一件相对痛苦的事 ,所以这里就提供一个解决的方案! 二.解决方案 想要智能提示 ...

  6. Jquery easy UI 上中下三栏布局 分类: ASP.NET 2015-02-06 09:19 368人阅读 评论(0) 收藏

    效果图: 源代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://w ...

  7. Xamarin Android布局文件没有智能提示

    Xamarin Android布局文件没有智能提示 在Visual Studio 2015中,Android项目的Main.axml文件没有智能提示,不便于布局文件的编写.解决办法:(1)从Xamar ...

  8. 用frame实现最基本的上中下三层布局,中间又分左右两部分.

    用frame实现最基本的上中下三层布局,中间又分左右两部分. 用frame的好处在于不用象DIV一样要对浮动和大小进行精确控制,以及要考虑宽屏的时候怎么办.而且在导航的时候非常简单.比如说,左边是导航 ...

  9. xamarin android布局

    xamarin android布局练习(1) xamarin android布局练习,基础非常重要,首先要学习的就是android的布局练习,xamarin也一样,做了几个xamarin androi ...

随机推荐

  1. 斗地主 ai的一些资料

    zt https://programming.iteye.com/blog/1491470 https://blog.csdn.net/abc1234679/article/details/79458 ...

  2. PHP不借助第三个变量交换值

    总结一下: //方法一: $a = "abc"; $b= "def"; $a = $a^$b; $b = $b^$a; $a = $a^$b; //方法二: l ...

  3. VS 在创建C#类时添加文件描述

    在新建一个C#类时,为了描述该类的功能.以及文件建立的相关信息,并保护自己的版权要在文件的开头添加一些信息.如下: /***************************************** ...

  4. 聚类K-Means

    import numpy as np x=np.random.randint(0,52,52) x k=3 y=np.zeros(20) y array([ 0., 0., 0., 0., 0., 0 ...

  5. 2019.03.29 bzoj3323: [Scoi2013]多项式的运算(非旋treap)

    传送门 题意:定义一个无穷项的多项式f(x)f(x)f(x),初始各项系数都为0,现在有几种操作 将xLx^LxL到xRx^RxR这些项的系数乘上某个定值v 将xLx^LxL到xRx^RxR这些项的系 ...

  6. js怎么把数字转化为字母(A,B.....AA,AB,..)

    function createCellPos( n ){ var ordA = 'A'.charCodeAt(0); var ordZ = 'Z'.charCodeAt(0); var len = o ...

  7. Day07 (黑客成长日记) 函数的参数及作用

    定义函数: 1.定义函数注意: (1)位置参数:直接定义函数. def func(a,b): print(a,b) func(1,2) (2)默认参数:关键字参数:参数名= ‘默认的值‘ def fu ...

  8. OPC转发阿里云alink工具

    这个最近还在做 2019-04-24 今天抽空吧基本mqtt上传,OPC遍历,导出物模型功能先做了 上报操作日志,上报错误信息,导入参数,导出参数还没做 有需要可以联系微信NBDX123

  9. JObject,JArray的基本操作

    引用:https://www.cnblogs.com/dacongge/p/6957074.html 1.JObject:基本的json对象 /// <summary> /// Gets ...

  10. 数据库(mysql)相关知识

      单表查询   排序   升序   select*from表名 order by字段 asc;   降序   select*from表名 order by字段 desc;   条件查询(包括通配符) ...