安卓之相对布局
2013-10-09 23:54
211 查看
<!--
android:layout_above 讲该控件的底部置于给定的ID的控件之上
android:layout_below 讲该控件的底部置于给定的ID的控件之下
android:layout_toLeftOf 讲该控件的右边缘和给定ID的控件的左边缘对齐
android:layout_toRightOf 讲该控件的走边缘和给定ID的控件的右边缘对齐
android:layout_alignBaseline 讲该控件的baseline和给定ID的控件的baseline对齐
android:layout_alignBottom 讲该控件的底部缘和给定ID的控件的底部缘对齐
android:layout_alignLeft 讲该控件的左边缘和给定ID的控件的左边缘对齐
android:layout_alignRight 讲该控件的右边缘和给定ID的控件的右边缘对齐
android:layout_alignTop 讲该控件的顶部和给定ID的控件的顶部对齐
android:alignParentBottom 如果为true 讲该控件的底部和父控件控件的底部对齐
android:layout_alignParentLeft 如果为true 讲该控件的左边和父控件控件的左边对齐
android:layout_alignParentRight 如果为true 讲该控件的右边和父控件控件的右边对齐
android:layout_alignParentTop 如果为true 讲该控件的顶部和父控件控件的顶部对齐
android:layout_centerHorizontal 如果为true 将控件水平方向的中央
android:layout_centerInParent 如果为true 该控件呗至于父控件水平方向和垂直方向
android:layout_centerVertical 如果为true 将该控件置于垂直方向的中央-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10px">
<TextView android:id="@+id/lable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入"/>
<EditText android:id="@+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/lable"/>
<Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edittext"
android:layout_alignParentRight="true"
android:layout_marginLeft="10px"
android:text="OK"/>
<Button android:id="@+id/cancel"
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_above 讲该控件的底部置于给定的ID的控件之上
android:layout_below 讲该控件的底部置于给定的ID的控件之下
android:layout_toLeftOf 讲该控件的右边缘和给定ID的控件的左边缘对齐
android:layout_toRightOf 讲该控件的走边缘和给定ID的控件的右边缘对齐
android:layout_alignBaseline 讲该控件的baseline和给定ID的控件的baseline对齐
android:layout_alignBottom 讲该控件的底部缘和给定ID的控件的底部缘对齐
android:layout_alignLeft 讲该控件的左边缘和给定ID的控件的左边缘对齐
android:layout_alignRight 讲该控件的右边缘和给定ID的控件的右边缘对齐
android:layout_alignTop 讲该控件的顶部和给定ID的控件的顶部对齐
android:alignParentBottom 如果为true 讲该控件的底部和父控件控件的底部对齐
android:layout_alignParentLeft 如果为true 讲该控件的左边和父控件控件的左边对齐
android:layout_alignParentRight 如果为true 讲该控件的右边和父控件控件的右边对齐
android:layout_alignParentTop 如果为true 讲该控件的顶部和父控件控件的顶部对齐
android:layout_centerHorizontal 如果为true 将控件水平方向的中央
android:layout_centerInParent 如果为true 该控件呗至于父控件水平方向和垂直方向
android:layout_centerVertical 如果为true 将该控件置于垂直方向的中央-->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10px">
<TextView android:id="@+id/lable"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="请输入"/>
<EditText android:id="@+id/edittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:drawable/editbox_background"
android:layout_below="@id/lable"/>
<Button android:id="@+id/ok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/edittext"
android:layout_alignParentRight="true"
android:layout_marginLeft="10px"
android:text="OK"/>
<Button android:id="@+id/cancel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/ok"
android:layout_alignTop="@id/ok"
android:text="cancel"/>
</RelativeLayout>
相关文章推荐
- 安卓相对布局
- 安卓相对布局的一个小问题记录
- RelativeLayout相对布局 安卓布局技巧
- 安卓开发08:布局-相对位置布局 RelativeLayout
- 安卓相对布局RelativeLayout
- RelativeLayout相对布局 安卓布局技巧
- 安卓常用布局(线性、相对、帧、表格布局)
- 【安卓开发】UI设计基础3:用相对布局RelativeLayout实现计算器
- 【安卓】关于相对布局RelativeLayout的各种属性介绍
- 安卓案例:利用相对布局实现注册页面
- 安卓中的相对布局RelativeLayout
- 安卓布局之相对布局(relativeLayout)
- RelativeLayout相对布局 安卓布局技巧
- 安卓开发之相对布局
- 安卓学习笔记之相对布局relativeLayout
- 安卓学习第二十一天:相对布局的使用,以及时间控件
- 安卓的相对布局
- 安卓布局 - 相对布局(RelativeLayout)
- 安卓 相对布局属性
- 安卓布局:线性布局(Linearlayout)和相对布局(RelativeLayout)