2012-05-03 147 views

回答

1

這取決於你如何使用它!

如果您希望自動調整佈局大小,您可以爲組成LinearLayout的視圖指定weight參數。

例如:

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:weightSum="1" 
    android:orientation="horizontal" 
> 
    <SomeView 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.5" 
    /> 

    <SomeView 
     android:layout_width="0dip" 
     android:layout_height="wrap_content" 
     android:layout_weight="0.5" 
    /> 
</LinearLayout> 

在這種情況下,你的兩個子視圖將共享整個水平空間和他們每個人都會乘坐空間的50%。