Why does NestedScrollView stop scrolling when CollapsingToolbarLayout is completely destroyed?

I use collapsingToolbarlayout with nestedscrollview , and it works fine until collapsingToolbarlayout is fully compensated, and the actionbar will show. This is where nestedscrollview stops scrolling, and some elements are still hidden.

here is my xml file

  <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.design.widget.AppBarLayout android:id="@+id/app_bar_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" > <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsing_toolbar" android:layout_width="match_parent" android:layout_height="match_parent" app:layout_scrollFlags="scroll|exitUntilCollapsed" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="48dp" app:expandedTitleMarginEnd="64dp" > <FrameLayout android:id="@+id/topLayout" android:layout_width="match_parent" android:layout_height="wrap_content" android:fitsSystemWindows="true" app:layout_collapseMode="parallax" > <ImageView android:id="@+id/BigThumbnailImage" android:layout_width="match_parent" android:layout_height="200dp" android:adjustViewBounds="true" android:fitsSystemWindows="true" android:src="@drawable/bg_health_news" android:scaleType="fitXY" /> </FrameLayout> <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:layout_collapseMode="pin" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:id="@+id/scroll" android:layout_width="match_parent" android:layout_height="match_parent" android:clipToPadding="false" app:layout_behavior="@string/appbar_scrolling_view_behavior" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:weightSum="1" > <include android:layout_width="match_parent" android:layout_height="0dp" layout="@layout/place_item_details_views" android:layout_weight="1" /> </LinearLayout> </android.support.v4.widget.NestedScrollView> </android.support.design.widget.CoordinatorLayout> 

I searched a lot and I don’t know why this is happening.

early

UPDATE

I found out that the problem is that I turn on the layout containing horizontalscrollview , and when it is empty or contains data, it causes this problem if someone knows that this problem can help me thanks

+2
android android-coordinatorlayout
source share
1 answer

I think the reason is that your last elements are off screen due to a shift, so you can try adding:

 android:paddingBottom="<your toolbar height in collapsed state>" 

for your NestedScrollView. In my case, it helped.

+3
source share

All Articles