Android   发布时间:2022-04-28  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了android – Scrollview使底部视图在Dialog中消失大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个对话框,在ScrollView中有一个列表(在LinearLayout中有一堆TextViews).布局如下:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://scheR_869_11845@as.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>

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

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

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

解决方法

尝试在scrollView中更改
<ScrollView
    android:id="@+id/filename_scroll"
    android:layout_width="match_parent"
    android:layout_weight="1"
    android:layout_height="0dp" >

大佬总结

以上是大佬教程为你收集整理的android – Scrollview使底部视图在Dialog中消失全部内容,希望文章能够帮你解决android – Scrollview使底部视图在Dialog中消失所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。