Adding Toobar directly to the appbarlayout gives you enteralwaycollapsed and exituntilcollapsed access to these scrolling tabs, Rather than the ability to control the details of how different elements respond to collapsing. To get the effect of the latter, you can use Collapsingtoolbarlayout:
1<Android.support.design.widget.AppBarLayout2 Android:layout_height= ' 192DP '3 Android:layout_width= ' match_parent '>4<Android.support.design.widget.CollapsingToolbarLayout5 Android:layout_width= ' match_parent '6 Android:layout_height= ' match_parent '7 App:layout_scrollflags= ' scroll|exituntilcollapsed '>8<Android.support.v7.widget.Toolbar9 Android:layout_height= '? attr/actionbarsize 'Ten Android:layout_width= ' match_parent 'App:layout_collapsemode= ' pin '/> A</Android.support.design.widget.CollapsingToolbarLayout> -</Android.support.design.widget.AppBarLayout>
The above settings use Collapsingtoolbarlayout's app:layout_collapsemode= "pin" attribute to ensure that the toolbar itself can still be booked at the top of the screen when the view is collapse. And maybe more, when you use Collapsingtoolbarlayout and toolbar together, when the layout is fully visible, the title will automatically appear larger and then transition to its default size when the toolbar collapse. Note that in these cases, you should call Collapsingtoolbarlayot's Settittle () instead of the Settitle () of the toolbar itself.
View collapsing toolbar effect Click (Note FQ when not open)
In addition to the ability to subscribe to a view, you can use App:layout_collapsemode= "parallax" (optional, app:layout_collapseparallaxmultiplier= "0.7" To set the scrolling parallax multiplication factor) to achieve scrolling parallax effects (such as sibling ImageView inside Collapsingtoolbarlayout). This use example will App:layout_collapseparallaxmultiplier and Collapsingtoolbarlayout's app:contentscrim= "? Attr/colorPrimary" Paired with a pair, the result is a full-bleed gauze effect added to the view collapse.
Material Design (10)--coordinatorlayout and app Bar