如何用两个相等的 LinearLayouts 分割屏幕? [英] How to split the screen with two equal LinearLayouts?
本文介绍了如何用两个相等的 LinearLayouts 分割屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
想用两个 LinearLayouts 为我的应用拆分一个屏幕.我应该使用什么参数来精确分割成两个相等的部分 - 第一个 LinearLayout 在顶部,第二个在它的正下方.
Wanna to split a screen for my app with two LinearLayouts. What parameters should I use to make exact splitting in two equal parts - first LinearLayout on the top and the second one is just under it.
推荐答案
使用 layout_weight
属性.布局大致如下:
Use the layout_weight
attribute. The layout will roughly look like this:
<LinearLayout android:orientation="horizontal"
android:layout_height="fill_parent"
android:layout_width="fill_parent">
<LinearLayout
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_width="0dp"/>
<LinearLayout
android:layout_weight="1"
android:layout_height="fill_parent"
android:layout_width="0dp"/>
</LinearLayout>
这篇关于如何用两个相等的 LinearLayouts 分割屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文