我只是想知道是否有可能在一个布局xml文件中,可能顶部的垂直线性布局有一个水平linearLayout然后低于它(在垂直布局内)有一个列表视图占用了屏幕的其余部分?
我无法找到具体的信息,我想知道它是否可能在我尝试之前,谢谢!
答案 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>