android學習筆記三--Activity 佈局

一、線性佈局android

標籤 :<LinearLayout></LinearLayout>佈局

方向:android:orientation, 垂直:vertical 水平:Horizontal it

控件所佔比例:android:layout_weightio

二、表格佈局技巧

標籤:<TableLayout></TableLayout>layout

行標籤:<TableRow></TableRow>vi

拉伸列:android:stretchColumns 如:「1」 表格填滿父窗體的狀況下 拉伸第2列以填滿表格標籤

佈局技巧:最後一列靠右對齊,如android:gravity="right"  中間列居中對齊 居中

三、相對佈局ab

標籤:<RelativeLayout></RelativeLayout>

android:layout_above 將控件置於指定id的控件上面對齊

android:layout_below 將控件置於指定id的控件下面對齊

android:layout_toLeftOf 將控件右邊緣與指定id的控件左邊對齊 

android:layout_toRightOf 將控件左邊緣與指定id的控件右邊對齊 

 

android:layout_alignLeft 將控件左邊緣與指定id控件左邊對齊

android:layout_alignRight將控件右邊緣與指定id控件的右邊緣對齊

android:layout_alignTop將控件上邊緣與指定id控件的上邊緣對齊

android:layout_alignBottom將控件底邊緣與指定id控件的底邊緣對齊

 

android:layout_alignBaseline 基準線對齊

android:layout_alignParentBottom 若是該值爲True 則將該控件的底部與父控件的底部對齊

android:layout_alignParentTop 若是該值爲True 則將該控件的頂部與父控件的頂部對齊

android:layout_alignParentLeft 若是該值爲True 則將該控件的左邊與父控件的左邊對齊

android:layout_alignParentRight 若是該值爲True 則將該控件的右邊與父控件的右邊對齊

 

android:layout_centerHorizontal 若是該值爲True 該控件將被置於水平方向的中央

android:layout_centerVertical 若是該值爲True 該控件將被置於垂直方向的中央

android:layout_centerInParent 若是該值爲True  該控件將被置於父控件水平方向和垂直方向的中央

相關文章
相關標籤/搜索