Learn to use material design control (IV) Android to realize the effect of automatic scaling and magnification of title bar
This article aims to realize the effect that the title bar automatically zooms / enlarges when the content is moved. The effect is as follows:
Control introduction
Many new controls need to be used this time, mainly including the following:
Coordinatorlayout is a layout that organizes the collaboration between its child views. It can provide animation effects for child view switching. Appbarlayout allows the controls contained in it to respond to the scrolling event of the view marked scrollingviewbehavior. Collapsingtoolbarlayout can control the controls contained in collapsingtoolbarlayout. In response to collapse, the screen is removed and fixed on the top tablayout is combined with viewpager, The function of switching multiple tabs is basically the same as that of nestedscrollview, but the appbarlayout can be scaled only when the controls contained in nestedscrollview are moved
Layout layout
For instructions on collapsingtoolbarlayout and tablayout, please refer to explore the new Android material design support library
code implementation
See here for detailed code
The source code of the project has been released to GitHub, and the new material design controls have been basically introduced. The next article will integrate these controls and make a demo in combination with Douban reading API. Source address: materialdesignexample
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.