In front of the design package of coordinatorlayout and Snackbar mixing, and now continue to understand the design package appbar;
Appbarlayout, like its name, takes the components of the container class all as AppBar.
Such as:
<android.support.design.widget.appbarlayout android:layout_width= "match_parent" app:theme= "@style/ Base.ThemeOverlay.AppCompat.Dark.ActionBar " android:layout_height=" wrap_content "> < Android.support.v7.widget.Toolbar app:layout_scrollflags= "scroll|enteralways" android:layout_width= " Match_parent " android:layout_height="? actionbarsize " android:id=" @+id/main_toolbar "/> < TextView android:layout_width= "match_parent" android:layout_height= "wrap_content" android:text= " Hover entry "/> </android.support.design.widget.AppBarLayout>
Here is to put toolbar and textview into the appbarlayout, let them as a whole as appbar.
Referencing AppBar's
App:layout_scrollflags= "Scroll|enteralways"
property, you can implement the drop-down when the AppBar is not displayed, while the pull-up shows the AppBar. This is really useful in user interaction.
Take a look at the collapsible toolbar.
<android.support.design.widget.appbarlayout android:layout_width= "match_parent" app:theme= "@style/base.t HemeOverlay.AppCompat.Dark.ActionBar "android:layout_height=" Wrap_content "> <!--collapsible toolbar--> <android.support.design.widget.collapsingtoolbarlayout android:layout_width= "Match_parent" and roid:layout_height= "Wrap_content" app:contentscrim= "@color/colorprimary" app:layout_scrollflags= "SCR Oll|exituntilcollapsed "> <imageview android:layout_width=" match_parent "and roid:layout_height= "200DP" app:layout_collapsemode= "parallax" android:src= "@mipmap/ic_launch Er "/> <android.support.v7.widget.toolbar app:layout_scrollflags=" Scroll|enteralways " Android:layout_width= "Match_parent" android:layout_height= "? Actionbarsize" Android : id= "@+id/main_toolbar"/> </android.support.design.widget.CollapsingToolbarLayout> <!--<TextView--> < ;! --android:layout_width= "Match_parent"-<!--android:layout_height= "Wrap_content"-<!- -android:text= "Hover entry"/>--> </android.support.design.widget.AppBarLayout>
It's very simple. You just need to modify it in the code above.
The AppBar and toolbar of the Android design package