Using:
compile 'com.android.support:design:23.0.0' compile 'com.android.support:appcompat-v7:23.0.0' compile 'com.android.support:cardview-v7:23.0.0' compile 'com.android.support:recyclerview-v7:23.0.0'
With the project Cheesesquare updated.
Into the detail of cheese, I remove 2 cards (to have only one). Is there a way to prevent the collapsing of the toolbar that show a blank space?
The solution is simple, we just need to set the app:scrimAnimationDuration=”0" in our collapsing toolbar layout like the below code snippet. Now just run the code and see the results, you will see then there will be no fading animation anymore.
CollapsingToolbarLayout is a wrapper for Toolbar which implements a collapsing app bar. It is designed to be used as a direct child of a AppBarLayout .
To implement such behaviour in Cheesesquare example just modify android:layout_height
param of the NestedScrollView to wrap_content
. It will prevent scrolling by content if it is small enough to fit on the screen.
And to prevent scrolling by CollapsingToolbarLayout
you should programmatically set layout_scrollFlags
parameter to the AppBarLayout.LayoutParams.SCROLL_FLAG_SNAP
value.
Here described how you can do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With