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?
In xml I have used property
app:layout_scrollFlags="snap"
in<android.support.design.widget.CollapsingToolbarLayout
and following in the activity
It is working now.
Here is my working code, to initially collapes the bar:
_appbar.setExpanded(false);
here is the layout xml
the reference is: AppBarLayout.setExpanded(boolean)
You can use below code for this:
To implement such behaviour in Cheesesquare example just modify
android:layout_height
param of the NestedScrollView towrap_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 setlayout_scrollFlags
parameter to theAppBarLayout.LayoutParams.SCROLL_FLAG_SNAP
value.Here described how you can do this.