Android programming realizes the home icon animation switching effect of actionbar

This article describes the example of Android programming to achieve the home icon animation switching effect of actionbar. Share with you for your reference, as follows:

An important feature of material design is that when the sideslip menu is expanded / closed, the home icon on the actionbar is also animated. This example aims to achieve this effect, as shown in the figure:

There are only a few steps to achieve this effect:

1. First, the layout of the page is a drawerlayout, and the code is as follows:

2. Specify the actionbar arrow button style for the program, that is, the drawerarrowstyle in the following code

Then, apply apptheme under the application tab in the manifest.

3. Activity inherits from appcompatactivity, and then adds code in oncreate method (using toolbar is similar):

4. Add the following code in onpostcreate of the activity, and call the drawertoggle. Syncstate() method in other places that may need to be refreshed.

More readers interested in Android related content can view the special topics of this site: summary of animation skills for Android development, summary of activity operating skills for Android programming, summary of view skills for Android, summary of layout skills for Android, introduction and advanced tutorial for Android development, summary of operating skills for Android resources, and Android control usage summary

I hope this article will help you in Android programming.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>