2010-08-03 94 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

相關問題