Implementation method of scrolling effect of Android support library title bar (toolbar)
Let's start with a renderings
Layout file code
In the layout file, coordinatorlayout is the root node of the layout file, appbarlayout is included in the coordinatorlayout, and toolbar is included under the appbarlayout node.
toolbar.xml
The toolbar needs to respond to the scrolling event of the view, so you need to specify the layout for the toolbar_ Scrollflags attribute. Scroll indicates that the toolbar will be hidden as the view scrolls down, and enteralways indicates that the toolbar will return to its original position as the view scrolls up.
Java code
The above method to realize the scrolling effect of the title bar (toolbar) of Android support library is all the content shared by Xiaobian. I hope it can give you a reference and support more programming tips.