Android RelativeLayout属性大全(中文解释)
来源:互联网 发布:fastreport 数据分栏 编辑:程序博客网 时间:2024/05/16 03:05
相对于给定ID控件
android:layout_above 将该控件的底部置于给定ID的控件之上;
android:layout_below 将该控件的底部置于给定ID的控件之下;
android:layout_toLeftOf 将该控件的右边缘与给定ID的控件左边缘对齐;
android:layout_toRightOf 将该控件的左边缘与给定ID的控件右边缘对齐;
android:layout_alignBaseline 将该控件的baseline与给定ID的baseline对齐;
android:layout_alignTop 将该控件的顶部边缘与给定ID的顶部边缘对齐;
android:layout_alignBottom 将该控件的底部边缘与给定ID的底部边缘对齐;
android:layout_alignLeft 将该控件的左边缘与给定ID的左边缘对齐;
android:layout_alignRight 将该控件的右边缘与给定ID的右边缘对齐;相对于父组件
android:layout_alignParentTop 如果为true,将该控件的顶部与其父控件的顶部对齐;
android:layout_alignParentBottom 如果为true,将该控件的底部与其父控件的底部对齐;
android:layout_alignParentLeft 如果为true,将该控件的左部与其父控件的左部对齐;
android:layout_alignParentRight 如果为true,将该控件的右部与其父控件的右部对齐;- 居中
android:layout_centerHorizontal 如果为true,将该控件的置于水平居中;
android:layout_centerVertical 如果为true,将该控件的置于垂直居中;
android:layout_centerInParent 如果为true,将该控件的置于父控件的中央; 指定移动像素
android:layout_marginTop 上偏移的值;
android:layout_marginBottom 下偏移的值;
android:layout_marginLeft 左偏移的值;
android:layout_marginRight 右偏移的值;example
android:layout_below = "@id/***"android:layout_alignBaseline = "@id/***"android:layout_alignParentTop = trueandroid:layout_marginLeft = “10px”
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView android:id="@+id/label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Type here:"/> <EditText android:id="@+id/entry" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@android:drawable/editbox_background" android:layout_below="@id/label"/> <Button android:id="@+id/ok" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/entry" android:layout_alignParentRight="true" android:layout_marginLeft="10dip" android:text="OK" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/ok" android:layout_alignTop="@id/ok" android:text="Cancel" /> </RelativeLayout>
这是很常见的布局内容,讲解如下:
android:layout_below=”@id/label”/>
将当前控件放置于id为label 的控件下方。
android:layout_alignParentRight=”true”
使当前控件的右端和父控件的右端对齐。这里属性值只能为true或false,默认false。
android:layout_marginLeft=”10dip”
使当前控件左边空出相应的空间。
android:layout_toLeftOf=”@id/ok”
使当前控件置于id为ok的控件的左边。
android:layout_alignTop=”@id/ok”
使当前控件与id控件的上端对齐。至此,我们已经发现,其属性之繁多。下面简单归纳一下:
- 第一类:属性值为true或false
*android:layout_centerHrizontal
*android:layout_centerVertical
*android:layout_centerInparent
*android:layout_alignParentBottom
*android:layout_alignParentLeft
*android:layout_alignParentRight
*android:layout_alignParentTop
*android:layout_alignWithParentIfMissing- 第二类:属性值必须为id的引用名“@id/id-name”
*android:layout_below
*android:layout_above
*android:layout_toLeftOf
*android:layout_toRightOf
*android:layout_alignTop- 第三类:属性值为具体的像素值,如30dip,40px
*android:layout_marginBottom
*android:layout_marginLeft
*android:layout_marginRight
*android:layout_marginTop
- Android RelativeLayout属性大全(中文解释)
- Android RelativeLayout 属性大全
- Android RelativeLayout 属性大全
- Android RelativeLayout 属性大全
- Android RelativeLayout属性大全
- android relativelayout属性大全
- Android之RelativeLayout 属性大全
- Relativelayout布局属性大全,包含大部分的属性解释
- Android布局之RelativeLayout属性大全
- Android布局之RelativeLayout属性大全
- android 相对布局RelativeLayout属性大全
- Android中RelativeLayout布局各个属性含义解释
- RelativeLayout相对布局属性大全
- Android学习(一)RelativeLayout布局属性
- android RelativeLayout常用属性
- Android RelativeLayout 属性
- Android RelativeLayout 属性 (
- Android RelativeLayout常用属性~
- JavaScript 前端神器avalonJS入门
- MyBatis Geneator 详解
- android学习 -- 短信发送器
- OpenCV中cvFindContours函数
- Android 深入理解Android中的自定义属性
- Android RelativeLayout属性大全(中文解释)
- Linux下inotify机制简介
- 队列的实现C语言
- 将格式化的日期字符串转换为Unix时间戳(php)
- 将输出的年月日修改为默认参数(第三章第三题)
- linux yum 安装rar和unrar
- 说说最小生成树(Minimum Spanning Tree)
- iOS开发系列之常用自定义控件开发集—自定义组按钮控件开发
- JAVA正则表达式 Pattern和Matcher