NestedScrollView could not scroll with match_parent height child NestedScrollView could not scroll with match_parent height child android android

NestedScrollView could not scroll with match_parent height child


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

This linearlayout should have android:layout_height="wrap_content".

Reason for that is that if the scrollview's child is the same size as the scrollview itself (both match_parent for height) it means that there is nothing to scroll through, since they are of same size and the scrollview will only be as high as the screen.

If the linearlayout has a height of wrap_content then the height is not related to the height of the screen and the scrollview will be able to scroll through it.

Just remember that a scrollview can only have 1 direct child, and that child needs android:layout_height="wrap_content"


In my case app:layout_behavior="@string/appbar_scrolling_view_behavior" this is working only if some one face problem will be try it and may be solve your problem too. you should add also android:fillViewport="true" but without this my code working.

 <android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:fillViewport="true"    xmlns:app="http://schemas.android.com/apk/res-auto"    android:background="@drawable/subscription_background"    app:layout_behavior="@string/appbar_scrolling_view_behavior">


For me it worked when i added "android:layout_marginBottom="100dp"" for last child in androidx.core.widget.NestedScrollView