您的位置:首页 > 其它

安卓之相对布局

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>

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: