ScrollView内部的FrameLayout [英] FrameLayout inside of ScrollView
问题描述
我是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
,但是对于RelativeLayout
,LinearLayout
...
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屋!