android RelativeLayout 属性学习

1.相对于给定ID控件  android:layout_below = "@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的右边缘对齐;

2.相对于父组件 android:layout_alignParentTop = true

android:layout_alignParentTop      如果为true,将该控件的顶部与其父控件的顶部对齐;

android:layout_alignParentBottom   如果为true,将该控件的底部与其父控件的底部对齐;

android:layout_alignParentLeft     如果为true,将该控件的左部与其父控件的左部对齐;

android:layout_alignParentRight    如果为true,将该控件的右部与其父控件的右部对齐;

3.居中 android:layout_centerHorizontal = true

android:layout_centerHorizontal 如果为true,将该控件的置于水平居中;

android:layout_centerVertical     如果为true,将该控件的置于垂直居中;

android:layout_centerInParent   如果为true,将该控件的置于父控件的中央;

4.指定移动像素 android:layout_marginLeft = "10px"

android:layout_marginTop      上偏移的值;

android:layout_marginBottom   下偏移的值;

android:layout_marginLeft   左偏移的值;

android:layout_marginRight   右偏移的值;



RelativeLayout学习案例    http://www.cnblogs.com/over140/archive/2011/03/14/1981196.html



猜你喜欢

转载自forlan.iteye.com/blog/2262338