2014-04-10 25 views
1

我只是想知道是否有可能在一個佈局的XML文件,也許一個垂直線性佈局在頂部有一個水平linearLayout,然後在下面(垂直佈局內)有一個列表視圖,佔用屏幕的其餘部分?listView內部的線性佈局與其他東西

我無法找到任何具體的信息,我想知道如果它可能之前我嘗試它,謝謝!

回答

1

給出ListView layout_height="0dp"layout_weight="1"。它將佔用未使用的剩餘空間,購買兄弟的LinearLayout。

<LinearLayout 
    android:layout_width:match_parent 
    android:layout_height:match_parent 
    android:orientation:vertical > 

    <LinearLayout 
     android:layout_width:match_parent 
     android:layout_height:wrap_content 
     android:orientation:norizontal > 

    <!-- other views ---> 

    </LinearLayout> 

    <ListView 
     android:layout_width:match_parent 
     android:layout_height:0dp 
     android:layout_weight:1 /> 

</LinearLayout> 
+0

謝謝,我想它會是這樣,但沒有把握。欣賞它 – erp