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

查看:33
本文介绍了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 的高度.当child比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天全站免登陆