2012-05-03 56 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%。