listView内部的线性布局

时间:2014-04-10 02:15:21

标签: android android-layout

我只是想知道是否有可能在一个布局xml文件中,可能顶部的垂直线性布局有一个水平linearLayout然后低于它(在垂直布局内)有一个列表视图占用了屏幕的其余部分?

我无法找到具体的信息,我想知道它是否可能在我尝试之前,谢谢!

1 个答案:

答案 0 :(得分: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>
相关问题