Android 的 Relative Layout 常量

android:layout_above 将该控件的底部置于给定ID的控件之上                    --Rule that aligns a child‘s bottom edge with another child‘s top edge.
android:layout_below 将该控件的顶部置于给定ID的控件之下                    --Rule that aligns a child‘s top edge with another child‘s bottom edge.
android:layout_toLeftOf 将该控件的右边缘和给定ID的控件的左边缘对齐            --Rule that aligns a child‘s right edge with another child‘s left edge.
android:layout_toRightOf 将该控件的左边缘和给定ID的控件的右边缘对齐            --Rule that aligns a child‘s left edge with another child‘s right edge.

android:layout_alignBaseline 该控件的baseline和给定ID的控件的baseline对齐        --Rule that aligns a child‘s baseline with another child‘s baseline.
android:layout_alignBottom 将该控件的底部边缘与给定ID控件的底部边缘            --Rule that aligns a child‘s bottom edge with another child‘s bottom edge.
android:layout_alignLeft 将该控件的左边缘与给定ID控件的左边缘对齐            --Rule that aligns a child‘s left edge with another child‘s left edge.
android:layout_alignRight 将该控件的右边缘与给定ID控件的右边缘对齐            --Rule that aligns a child‘s right edge with another child‘s right edge.
android:layout_alignTop 将给定控件的顶部边缘与给定ID控件的顶部对齐            --Rule that aligns a child‘s top edge with another child‘s top edge.

android:alignParentBottom 如果该值为true,则将该控件的底部和父控件的底部对齐        --Rule that aligns the child‘s bottom edge with its RelativeLayout parent‘s bottom edge.
android:layout_alignParentLeft 如果该值为true,则将该控件的左边与父控件的左边对齐    --Rule that aligns the child‘s left edge with its RelativeLayout parent‘s left edge.
android:layout_alignParentRight 如果该值为true,则将该控件的右边与父控件的右边对齐    --Rule that aligns the child‘s right edge with its RelativeLayout parent‘s right edge.
android:layout_alignParentTop 如果该值为true,则将空间的顶部与父控件的顶部对齐        --Rule that aligns the child‘s top edge with its RelativeLayout parent‘s top edge.

android:layout_centerHorizontal 如果值为true,该控件将被置于水平方向的中央        --Rule that centers the child horizontally with respect to the bounds of its RelativeLayout parent.
android:layout_centerInParent 如果值为true,该控件将被置于父控件水平方向和垂直方向的中央--Rule that centers the child with respect to the bounds of its RelativeLayout parent.
android:layout_centerVertical 如果值为true,该控件将被置于垂直方向的中央        --Rule that centers the child vertically with respect to the bounds of its RelativeLayout parent.

时间: 2024-07-29 21:07:43

Android 的 Relative Layout 常量的相关文章

Android -如何在底部左对齐,中对齐,右对齐三个按钮图片 巧用Relative Layout

Relative Layout 不仅可以指定同级的元素之间的位置关系(e.g. layout_toLeftOf) 还可以指定子元素与父元素之间的位置关系(e.g. layout_alignParentLeft 相对于父元素左对齐) 利用这一点,可以轻松实现图片在屏幕底部对齐显示. 代码如下: <?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://

Android五大布局Layout

 Android开发中,我们可能会遇到过一些很复杂的布局,对于初学者来说,可能脑子会嗡的一下,"这么复杂!该怎么整?!". 不要担心!再复杂的布局其实也是由简单地布局组成的,我们要学会将它分解成基本的布局,那么问题就迎刃而解了. Android共有五种常见布局方式,分别是:LinearLayout(线性布局),FrameLayout(单帧布局),AbsoluteLayout(绝对布局),RelativeLayout(相对布局),TableLayout(表格布局). 下面首先看一下这

Android 高效的 Layout

心静志远 | 技术会被淘汰,但思想会一直永存(多思考,多总结,多分享) 我们知道随着我们业务越来越负责,UI布局也会越来越复杂,大量的布局信息必定会带来一定的性能损耗,那么我们怎么才能写出高效的布局呢? 1. 使用 <include> <merge> <viewStub>标签. https://developer.android.com/training/improving-layouts/optimizing-layout.html 2.?LinearLayout中减

Android 布局(Layout)指南

太阳火神的美丽人生 (http://blog.csdn.net/opengl_es) 本文遵循"署名-非商业用途-保持一致"创作公用协议 转载请保留此句:太阳火神的美丽人生 -  本博客专注于 敏捷开发及移动和物联设备研究:iOS.Android.Html5.Arduino.pcDuino,否则,出自本博客的文章拒绝转载或再转载,谢谢合作. Android 官方文档 布局 相关资源链接汇总如下: android-sdk-macosx-4.4.2/docs/guide/topics/ui

XML Relative Layout Demo

<?xml version="1.0" encoding="utf-8"?> <LinearLayout android:id="@+id/container" android:layout_width="match_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:layout_heigh

Android measure和layout的一点理解

首先,推荐文章,http://blog.csdn.net/hqdoremi/article/details/9980481,http://www.docin.com/p-571954086.html 我理解measure的作用有2个:一个就是调用子view的measure函数,生成他们的高度和宽度,以便在自己的layout阶段参考:另一个是为父view提供关于自己的测量的width和height(这个宽度和高度往往和子view的测量高度和宽度有关),以便父view在layout阶段参考. lay

Android - HelloWorld的Layout内容

Android - HelloWorld的Layout内容 本文地址: http://blog.csdn.net/caroline_wendy 作为最基础的Android程序, HelloWorld的XML文件能够作为測试使用. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools&q

Android Relative Layout 安卓相对布局详解

思维导图可在幕布找到 1. 基础 如果在相对布局里,控件没有指明相对位置,则默认都是在相对布局的左上角: <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#FF00FF" android:padding="20dp" android:text="Item2

Android 获取 content layout

if (findViewById(android.R.id.content) instanceof ViewGroup) { ViewGroup mainView = ((ViewGroup)findViewById(android.R.id.content)); if (mainView.getChildCount() != 0) { ((ViewGroup)mainView.getChildAt(0)).addView(quitButton); } else { mainView.addVi