android學習筆記(二)
LinearLayout:線性布局.可以使用垂直線形布局,也可以使用水平布局,在LinearLayout里面可以放多個控件,但是一行(列)只能放一個控件.android:orientation = "vertical" 垂直方式排列
android:orientation = "horizontal" 水平方式排列
RelativeLayout:相對布局.RelativeLayout里面可以放多個控件,不過控件的位置都是相對位置.
android:layout_below = "@id/label" 運用上一個標簽id縮定上一個標簽的相對位置,將自身標簽排列在其下.
android:layout_toLeftOf = "@id/label" 將自身標簽縮定在上一個標簽之左.
android:layout_alignTop = "@id/label" 將自身標簽縮定和上一個標簽相同高度.
TableLayout:表單布局.這要和TableRow配合使用,很像HTML里面的TABLE.
<TableLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:stretchColumns="1">
<TableRow>
<TextView
android:layout_column="1"
android:text="打開..."
android:padding="3dip"/>
<TextView
android:text="Ctrl-O"
android:gravity="right"
android:padding="3dip"/>
</TableRow>
</TableLayout>