滚动型底部,使意见在对话框消失 [英] Scrollview makes bottom views disappear in a Dialog

查看:231
本文介绍了滚动型底部,使意见在对话框消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有了一个列表的对话框(里面一堆的TextView 的LinearLayout )内的滚动型。布局如下:

I have a dialog that has a list (a bunch of TextViews inside a LinearLayout) inside a ScrollView. The layout is as follows:

<?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>

它看起来像这样只有在名单上的几个项目:

It looks like this with only a few items on the list:

但是,当有不止可以在屏幕上显示(并有实际需要滚动),我的按钮被推在屏幕下方。当所有的方式滚动至底部,它看起来像这样:

But when there's more than can fit on the screen (and there's actual need to scroll), my buttons get pushed below the screen. When scrolling all the way to the bottom, it looks like this:

我需要的的LinearLayout 包含按钮继续担任页脚,它不应该在任何地方滚动,显然不会消失。我试着布局身高和体重摆弄,但无济于事。

I need the LinearLayout containing the buttons to stay as footer, it shouldn't scroll anywhere and obviously not disappear. I've tried fiddling with the layout heights and weights, but to no avail.

推荐答案

尝试在滚动视图改变

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

这篇关于滚动型底部,使意见在对话框消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆