Java Android可滚动布局-方向更改时视图不可见

Java Android可滚动布局-方向更改时视图不可见,java,android,android-layout,android-view,android-scrollview,Java,Android,Android Layout,Android View,Android Scrollview,我正在进行的XML滚动布局工作如下所示: <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_

我正在进行的XML滚动布局工作如下所示:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <ListView
        android:id="@+id/list"
        android:layout_height="wrap_content"
        android:layout_width="match_parent"
        >
    </ListView>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/tvStatus"
            android:text="0 SMS found"
            android:textSize="15sp"
            android:layout_width="120dp"
            android:layout_height="wrap_content"  />
        <Button
            android:id="@+id/btnExport"
            android:layout_width="88dp"
            android:layout_height="wrap_content"
            android:text="Export"
            />
    </LinearLayout>
</LinearLayout>
</ScrollView>
在纵向模式下将应用程序加载到测试设备上时,所有视图都显示并可见: 当设备方向更改为水平时,只有布局的listview部分可见
有人知道这里可能发生了什么吗?谢谢。

这是您需要的布局:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical">

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

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/tvStatus"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:text="0 SMS found"
            android:textSize="15sp"/>

        <Button
            android:id="@+id/btnExport"
            android:layout_width="88dp"
            android:layout_height="wrap_content"
            android:text="Export"
            />
    </LinearLayout>

</LinearLayout>
您还可以在构建布局时查看布局在横向模式下的效果:


您似乎缺少滚动视图的结束标记。

不要使滚动视图直接指向xml。制作线性布局并将scrollview放入其中,但这会导致屏幕上只显示一行listview。这既快速又高效!非常感谢,伙计,你是一个节约者:你是对的,我没有正确粘贴它,但它是在代码中显示的,所以这不是问题所在。