Child inside NestedScrollView not cover full height of screen

ぐ巨炮叔叔 提交于 2020-12-01 08:22:52

问题


I am using NestedScrollView in my fragment. In my xml inside a RelativeLayout but it is not covering full height of screen.

Below is my code -

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:fitsSystemWindows="true"
android:background="@color/black"
android:layout_width="match_parent"
android:layout_height="match_parent">

<RelativeLayout
    android:background="@color/red_error_color"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


</RelativeLayout>
</android.support.v4.widget.NestedScrollView>

when run the code only black background is visible but not red as my child view background is red.

Thanks in advance


回答1:


Try to add this line of code on your nestedscrollview

android:fillViewport="true"
app:layout_behavior="@string/appbar_scrolling_view_behavior"

Remove:

android:fitsSystemWindows="true"


来源:https://stackoverflow.com/questions/42996723/child-inside-nestedscrollview-not-cover-full-height-of-screen

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!