ScrollView内部的FrameLayout [英] FrameLayout inside of ScrollView

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

问题描述

我是android开发的新手,并且遇到以下问题. 我需要在ScrollView内使用FrameLayout使其可滚动.我写了这个

I'm new to android development and I have the following problem. I need to use FrameLayout inside of ScrollView for making it scrollable. I wrote this

    <ScrollView
    android:id="@+id/scrollView1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_alignParentLeft="true"
    android:layout_alignParentTop="true" 
    android:background="#00ff00">

    <FrameLayout
        android:id="@+id/frameLayout"
        android:layout_width="match_parent"
        android:layout_height="500dp"
        android:background="#ff0000">
    </FrameLayout>
   </ScrollView>

但这不起作用.我在RelativeLayout中进行了尝试,但仍有效,但是我需要在FrameLayout中使用. 有什么想法吗?

But this doesn't work. I tried in RelativeLayout and it worked, but I need to use for FrameLayout. Any ideas?

推荐答案

我尝试了多种方法来解决此问题,包括此处的答案,但没有人提供帮助. ScrollView总是包裹FrameLayout,但是对于RelativeLayoutLinearLayout ...

I tried many variants for solving this problem, including answers here, but no one was helpful. ScrollView always wraps FrameLayout, but everything is normal with RelativeLayout, LinearLayout...

我找到了一个解决方案-设置FrameLayout的最小高度.您可以通过setMinimumHeight()方法动态设置最小高度.

I have found one solution for this - to set minimum height of FrameLayout. You can set dynamically minimum height by setMinimumHeight() method.

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

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