LinearLayout版面配置
線性佈局版面配置,每一行只放一個物件,依方向可分為垂直及水平方向
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
<!-- 切割視窗的屬性 -->
android:layout_weight="1">
<SurfaceView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"/>
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Run Time"/>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Stop!!"/>
</LinearLayout>
</LinearLayout>
假設一個Layout裡包含了2個LinearLayout,分別是LinearLayout_A和LinearLayout_B
當android:layout_weight的屬性分別設定為(3,2)時
LinearLayout_A會占全部畫面的2/(3+2)
LinearLayout_B會占全部畫面的3/(3+2)
沒有留言:
張貼留言