RelativeLayout

// 相對於給定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/***"

android:layout_alignBaseline = "@id/***"

android:layout_alignParentTop = true

android:layout_marginLeft = “10px”
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章