为什么LinearLayout不能在不同的屏幕上调整大小?
发布于 2012-05-03 19:49:29
这取决于你是如何使用它的!
如果希望自动调整布局的大小,可以为组成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%的空间。
https://stackoverflow.com/questions/10430656
复制相似问题