android – Scrollview使底部视图在Dialog中消失

前端之家收集整理的这篇文章主要介绍了android – Scrollview使底部视图在Dialog中消失前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个对话框,在ScrollView中有一个列表(在LinearLayout中有一堆TextViews).布局如下:
<?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>@H_301_3@ 
 

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

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

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

解决方法

尝试在scrollView中更改
<ScrollView
    android:id="@+id/filename_scroll"
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="0dp" >@H_301_3@
原文链接:https://www.f2er.com/android/317097.html

猜你在找的Android相关文章