FrameLayout中的可滚动布局 [英] Scrollable layout in FrameLayout

查看:96
本文介绍了FrameLayout中的可滚动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在android应用程序上有一个FrameLayout,但是我无法使该布局的一部分滚动...我尝试了一些解决方案来解决此问题,但找不到补丁! 通常,我希望在Scrollview标签之间看到可滚动的linearlayout(也许不是linearlayout).

I've a FrameLayout on my android app but I can't make to scrollable a part of this layout...I've tried some solutions to fix this problem, but I can't find a patch! Pratically, I would like to see scrollable the linearlayout (maybe, linearlayout is not necessary) between Scrollview tags.

这是我的xml:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.robertot.timereport.com.robertot.timereport.Pages.YearlyStatFragment">

        <ScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent">

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

                // Some views to scroll

            </LinearLayout>

        </ScrollView>

        <LinearLayout
            android:id="@+id/bottom_linear"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:orientation="horizontal"
            android:layout_gravity="bottom"
            style="@android:style/Widget.Holo.Light.ActionBar.Solid">

            <Spinner
                android:id="@+id/spnYearY"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="8dp"/>

            <ImageButton
                android:id="@+id/btnFilter"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/ic_search"
                android:background="@null"
                android:layout_weight="1"
                android:layout_gravity="center_vertical"/>

        </LinearLayout>

</FrameLayout>

谢谢! :)

推荐答案

在FrameLayout中,所有内容视图都位于另一个视图之上,因此正常行为是线性布局隐藏了以前Scrollview的一部分.为什么不使用LinearLayout或相对布局而不是FrameLayout?

In a FrameLayout all the content views are one on top of the other, so the normal behaviour is that the Linear Layout hides part of the previous Scrollview. Why don't you use a LinearLayout or a Relative Layout instead of the FrameLayout?

这篇关于FrameLayout中的可滚动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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