For CollapsingToolbarLayout use the scroll flags:
app:layout_scrollFlags="scroll|enterAllwaysCollapsed"
this combination of flags will disappear from the toolbar when scrolling down. And CollapsingToolbarLayout will fully expand when you go to the top of the list.
And there is no need to remove app:layout_collapseMode="pin" from the Toolbar , because the collapseMode flags should determine the behavior and placement of views inside the CollapsingToolbarLayout and will not affect the actual collapse and extension of the CollapsingToolbarLayout .
source share