Scrollview使底部视图在Dialog中消失

j0n*_*ech 8 android scrollview android-layout

我有一个对话框,里面有一个列表(TextView里面有一堆s LinearLayout)ScrollView.布局如下:

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

    <ProgressBar
        android:id="@+id/delete_progress"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:visibility="gone" />

    <ScrollView
        android:id="@+id/filename_scroll"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:id="@+id/filename_container"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

    <View
        android:id="@+id/horisontal_separator"
        android:layout_width="fill_parent"
        android:layout_height="1dp"
        android:background="@android:color/darker_gray" />

    <LinearLayout
        android:id="@+id/button_container"
        android:layout_width="match_parent"
        android:layout_height="48dp" >

        <Button
            android:id="@+id/load_button"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/button_load"
            android:gravity="center"
            android:layout_weight="1" />

        <View
            android:layout_width="1dp"
            android:layout_height="fill_parent"
            android:background="@android:color/darker_gray" />

        <Button
            android:id="@+id/delete_button"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:text="@string/button_delete"
            android:gravity="center"
            android:layout_weight="1" />
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

它看起来像只有列表中的几个项目: 列表中的一些项目

但是当屏幕上有更多东西可以放入时(实际需要滚动),我的按钮会被推到屏幕下方.当一直滚动到底部时,它看起来像这样: 列表上有很多项目

我需要LinearLayout包含按钮作为页脚,它不应该滚动到任何地方,显然不会消失.我试图摆弄布局高度和重量,但无济于事.

ume*_*esh 22

尝试在scrollView中更改

<ScrollView
    android:id="@+id/filename_scroll"
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="0dp" >
Run Code Online (Sandbox Code Playgroud)