I am trying to do collapsingtoolbar with a nested scrollview. They work fine, but if im is at the bottom of the nested scroll and I do a very fast scroll (one quick scroll), it scrolls until the top of the nested scrollview, but the collapsingtoolbar expands.
Sorry for my English.
code:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/rootLayout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" android:background="#fff"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="256dp" android:fitsSystemWindows="true" android:elevation="4dp" android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"> <android.support.design.widget.CollapsingToolbarLayout android:id="@+id/collapsingToolbarLayout" android:layout_width="match_parent" android:layout_height="match_parent" app:contentScrim="?attr/colorPrimary" app:expandedTitleMarginStart="64dp" app:layout_scrollFlags="scroll|exitUntilCollapsed"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:scaleType="centerCrop" android:src="@drawable/secimage" app:layout_collapseMode="parallax" app:layout_collapseParallaxMultiplier="0.7" app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed" /> <android.support.v7.widget.Toolbar android:id="@+id/toolbarapp" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:minHeight="?attr/actionBarSize" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" app:layout_scrollFlags="scroll|enterAlways" app:layout_collapseMode="pin" /> </android.support.design.widget.CollapsingToolbarLayout> </android.support.design.widget.AppBarLayout> <android.support.v4.widget.NestedScrollView android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" android:clipToPadding="false" android:layout_gravity="fill_vertical" android:scrollbars="none" app:layout_behavior="@string/appbar_scrolling_view_behavior"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Yo Yo" /> </LinearLayout> </android.support.v4.widget.NestedScrollView>
source share