FrameLayout与NestedScrollView的高度不匹配 [英] FrameLayout does not match the height of NestedScrollView

查看:352
本文介绍了FrameLayout与NestedScrollView的高度不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NestedScrollView中有一个FrameLayout,就像

I have a FrameLayout inside a NestedScrollView, as

<android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="#000000">

但是FrameLayout不能填充NestedScrollView的高度.我该如何解决?

But the FrameLayout is not filling the height of the NestedScrollView. How might I fix this?

推荐答案

选中此解决方案
使用fillViewport="true" 如果需要,此属性会使滚动视图的子级扩展到ScrollView的高度.当孩子比ScrollView高时,该属性无效.

Check This Solution
Use fillViewport="true" this attribute causes the scroll view’s child to expand to the height of the ScrollView if needed. When the child is taller than the ScrollView, the attribute has no effect.

 <android.support.v4.widget.NestedScrollView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
      android:fillViewport="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">

这篇关于FrameLayout与NestedScrollView的高度不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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