// 相对于给定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/***"<!-- lang: xml --><!-- lang: xml -->android:layout_alignBaseline = "@id/***"<!-- lang: xml --><!-- lang: xml -->android:layout_alignParentTop = true<!-- lang: xml --><!-- lang: xml -->android:layout_marginLeft = “10px”

example2:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"android:orientation="vertical"android:layout_width="fill_parent"android:layout_height="fill_parent">    <!-- 定义该组件位于父容器中间 -->       <TextView         android:id="@+id/view01"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/leaf"        android:layout_centerInParent="true"        />    <!-- 定义该组件位于view01组件的上方 -->    <TextView         android:id="@+id/view02"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/leaf"        android:layout_above="@id/view01"        android:layout_alignLeft="@id/view01"        />    <!-- 定义该组件位于view01组件的下方 -->    <TextView         android:id="@+id/view03"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/leaf"        android:layout_below="@id/view01"        android:layout_alignLeft="@id/view01"        />    <!-- 定义该组件位于view01组件的左边 -->    <TextView         android:id="@+id/view04"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/leaf"        android:layout_toLeftOf="@id/view01"        android:layout_alignTop="@id/view01"        />    <!-- 定义该组件位于view01组件的右边 -->    <TextView         android:id="@+id/view05"        android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:background="@drawable/leaf"        android:layout_toRightOf="@id/view01"        android:layout_alignTop="@id/view02"        />          </RelativeLayout>

图片:

更多相关文章

  1. Android布局之xml设置
  2. Android(安卓)RelativeLayout 属性
  3. Android(安卓)RelativeLayout 属性
  4. Android(安卓)RelativeLayout 属性大全
  5. Android(安卓)UI布局之区分 android:gravity 和 android:layout_
  6. Android相对布局
  7. 《Android移动应用基础教程》(Android(安卓)Studio)(第二版)黑马教程
  8. Android(安卓)RelativeLayout属性
  9. Android(安卓)RelativeLayout 属性

随机推荐

  1. OnTouchListener与OnGestureListener的区
  2. android JSON解析数据 android解析天气预
  3. android 五大布局-线性布局(LinearLayout)
  4. Maven Android使用一
  5. Android(安卓)使用Pull方法解析XML文件的
  6. Android(安卓)Tutorial #4.2: Passing cu
  7. Android(安卓)Fragment getActivity返回n
  8. delphi xe5 android tts(Text To Speech)
  9. 关于EditText的属性和常识
  10. Android选择本地图片并裁剪工具类