五大布局——相对布局
来源:互联网 发布:软件求职自我介绍 编辑:程序博客网 时间:2024/05/29 11:10
1.RelativeLayout属性
1.alignParentLeft Right Bottom Top 相对父空间的上下左右
2.centerInParent centerVertical centerHorizontal
3.toLeftOf(R)=”@id/”……在 的左边 above below
4. alingleft(R,T,B)=”@id/”相对后边跟的ID的那个空间上下左右边对齐
5. layout_alignBaseline 基准线对齐
2.RelativeLayout布局的实现
alignParentLeft(R,B,T),centerInParent的实现
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" > <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="button1" android:id="@+id/button" android:layout_alignParentLeft="true" android:background="@color/red" ></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@color/red"></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:background="@color/red" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:background="@color/red" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentRight="true" android:background="@color/red"></Button> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:background="@color/red"/></RelativeLayout>
2.toLeftOf(R),layout_above,layou_below
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerInParent="true" android:text="center" android:id="@+id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/button" android:layout_below="@id/button"/><Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/button" android:layout_above="@id/button"/></RelativeLayout>
3.alignLeft(R,T,B)
<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:layout_width="200dp" android:layout_height="200dp" android:layout_centerInParent="true" android:id="@id/button" android:background="@color/red"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignRight="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBottom="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignTop="@id/button" android:layout_alignRight="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@id/button" android:layout_alignBottom="@id/button"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@id/button"/></RelativeLayout>
0 0
- 五大布局——相对布局
- Android五大布局之相对布局
- 五大布局-----RelativeLayout相对布局
- Android五大布局方式——相对布局(RelativeLayout)属性详解
- Android 五大布局之线性布局和相对布局
- 五大布局——线性布局
- Android--五大布局(2)相对布局RelativeLayout
- android五大布局之RelativeLayout(相对布局)
- android 五大布局(3)相对布局
- 布局——线性布局、相对布局
- RelativeLayout—相对布局
- 五大布局——表格、帧、绝对布局
- Android 五大布局之(一) 线性布局和相对布局
- 入门——Android 五大布局
- 布局管理器——相对布局
- 五布局之相对布局RelativeLayout
- Android学习-五布局之相对布局
- Android布局———RelativeLayout布局(相对布局)
- Spring---Spring MVC 应用
- C/C++程序运行时的内存结构
- Spring和Hibernate和Struts整合(二)实现登陆验证
- 九度oj 1084
- HDU5386 Cover 果然还是暴力
- 五大布局——相对布局
- HDU1528Card Game Cheater(最大匹配)
- 英语常用时态
- String类
- @synthesize、 @dynamic 的使用方法
- 判断一个单链表中是否存在环
- 【Linux探索之旅】第一部分第六课:Linux如何安装在虚拟机中
- TinyXml 操作XML 常用操作 http://www.cnblogs.com/cy568searchx/p/3670400.html
- ros消息时间同步与回调