如何使用两个相等的LinearLayouts拆分屏幕? [英] How to split the screen with two equal LinearLayouts?

查看:104
本文介绍了如何使用两个相等的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆