2010-08-03 93 views
0

我在屏幕中使用了两个ListView。我想分割每个ListView的高度,但我希望它是独立于屏幕的。为此,我需要知道屏幕的高度。我正在使用XML来做到这一点。 任何人都可以帮助我做到这一点?根据屏幕高度设置布局

谢谢 迪帕克

回答

0

试试这个:

<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" 
> 
    <ListView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    /> 
    <ListView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_weight="1" 
    /> 
</LinearLayout> 

重要的部分有ListViewsandroid:layout_height="fill_parent"android:layout_weight="1"LinearLayoutandroid:orientation="vertical"

Documentation了解更多关于layout_weight属性的信息。

0

试的意见“补父”和布局重布局的高度设置为1

相关问题