Java 我的listview没有';t填充父对象

Java 我的listview没有';t填充父对象,java,android,listview,scrollview,Java,Android,Listview,Scrollview,用垂直线性布局替换相对布局,并在列表视图上设置android:layout\u weight=“1”和android:layout\u height=“wrap\u content”: <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TextView


用垂直
线性布局替换
相对布局
,并在列表视图上设置
android:layout\u weight=“1”
android:layout\u height=“wrap\u content”

<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">

    <TextView 
        android:id="@+id/tv_test"
        android:text="Test "
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <ListView 
        android:id="@+id/list_test"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_below="@id/tv_test" />
</LinearLayout>

有关布局权重的详细信息,请查看


另外,我将删除
滚动视图
ListView
管理滚动本身,如果将其嵌入处理滚动的容器中,您将遇到各种问题。如果你想滚动<代码> @是/tvyTest连同你的代码> ListVIEW 内容,那么考虑把它放在你的<代码> ListVIEW 中作为标题。如果您希望它在
列表视图
滚动时保持静态,则将其保持在
列表视图
之外,我认为您的滚动视图并没有填满整个屏幕。在scrollView中使用此选项

android:fillViewport="true"

你能展示一下整个xml代码吗?它运行得很好,伙计,我检查了你的代码并执行了。也许在你的xml中的某个地方你有包装的内容而不是填充的内容。因此,如果您发送所有的xml代码,我将能够帮助它正常工作,但我接下来要做的是:使listview与ScrollView一起工作。寻找IMDB Android应用程序,因为他们有一个滚动视图,你可以看到里面有listview,它看起来不像列表。如果你只有textview和listview,那么我认为你不需要使用滚动视图,只需使用listview并向其添加页眉或页脚任何视图。好的,谢谢这是解决方案,但我有一件小事情想做:滚动布局中的所有内容,就像它是一个相同的屏幕。这是一个很好的解决方案。作为说明,我必须在它包含的ScrollView和ListView中添加这个值。在android studio 0.9.9中,有一个UI复选框选项可以直接启用此功能。感谢您的帮助:)+1提到您不应该在scrollview中包含listview。今天早上我有点不对劲
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent">

    <TextView 
        android:id="@+id/tv_test"
        android:text="Test "
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" />
    <ListView 
        android:id="@+id/list_test"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:layout_below="@id/tv_test" />
</LinearLayout>
android:fillViewport="true"