控件的 android:layout_alignParent 属性,只有在该布局的父布局也是RelativeLayout时才有用
相对于父控件边缘:
android:layout_alignParentLeft=“true” --将控件的左边缘和父控件的左边缘对齐
android:layout_alignParentTop=“true” --将控件的上边缘和父控件的上边缘对齐
android:layout_alignParentRight=“true” --将控件的右边缘和父控件的右边缘对齐
android:layout_alignParentBottom=“true” --将控件的底边缘和父控件的底边缘对齐
相对于父控件中心:
android:layout_centerInParent=“true” --将控件置于父控件的中心位置
android:layout_centerHorizontal=“true” --将控件置于水平方向的中心位置
android:layout_centerVertical=“true” --将控件置于垂直方向的中心位置
相对于最近控件:
layout_marginTop
指定该属性所在控件距上部最近控件的最小值;
layout_marginBottom
指定该属性所在控件距下部最近控件的最小值;
layout_marginLeft
指定该属性所在控件距左边最近控件的最小值;
layout_marginRight
指定该属性所在控件距右边最近控件的最小值。
相对于给定ID控件:
android:layout_above
将该控件的底部置于给定ID的控件之上;
android:layout_below
将该控件的底部置于给定ID的控件之下;
android:layout_alignTop
将该控件的顶部边缘与给定ID的顶部边缘对齐;
android:layout_alignBottom
将该控件的底部边缘与给定ID的底部边缘对齐;