Android ListView没有';不要扩展整个屏幕

Android ListView没有';不要扩展整个屏幕,android,listview,Android,Listview,我有一个类似于这里的问题: XML是: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"

我有一个类似于这里的问题:

XML是:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:id="@+id/ResultLayout">

    <ScrollView android:layout_width="fill_parent" android:layout_height="fill_parent">
        <ListView android:layout_width="fill_parent" android:id="@+id/ListView"
            android:layout_height="fill_parent"></ListView>
    </ScrollView>
    <LinearLayout android:id="@+id/pagingPanel"
        android:gravity="center" android:layout_width="fill_parent"
        android:layout_height="fill_parent" android:orientation="horizontal"></LinearLayout>
    <Spinner android:layout_width="fill_parent" android:id="@+id/ManSpinner"
        android:layout_height="fill_parent" />
</LinearLayout>

在这种情况下,我应该有一个
滚动视图
,或者
分页面板
线性布局
将消失

编辑
所需的布局是将所有元素堆叠在彼此的顶部。但是如果元素超过了页面高度,则应在
列表视图中添加一个滚动条如果您有一个垂直
线性布局
,则不能为
线性布局
元素的
布局高度
添加多个
填充父项。您希望实现什么样的布局?是否为所有元素统一划分屏幕

另一个问题是在
ScrollView
中使用
ListView
也不是一个好主意,因为
ListView
本身是可滚动的

您应该编写希望用XML实现的布局。通常情况下,在多个步骤中编写XML并逐个布局迭代工作解决方案布局也是一种很好的做法

编辑:好的,尝试以下操作:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" 
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:id="@+id/ResultLayout">

    <ListView android:id="@+id/ListView"
        android:layout_width="fill_parent" 
        android:layout_height="0dp"
        android:layout_weight="1" />

    <LinearLayout android:id="@+id/pagingPanel"
        android:gravity="center" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" 
        android:orientation="horizontal">

    </LinearLayout>

    <Spinner android:id="@+id/ManSpinner"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" />

</LinearLayout>


您想要实现什么目标?看到你的布局,你现在应该只能看到旋转器。它像魔术一样工作。。非常感谢!,顺便说一句,你能给我提供一个链接,让我了解如何一起布局组件。。我对安卓非常陌生!我很高兴这有帮助。几个月前,当我开始使用android时,我已经阅读了这些系列教程。。。我认为他们写得非常友好: