Bottom navigation effect of Android bottomnavigationview

Bottomnavigationview appeared in material design a long time ago, but the bottomnavigationview control was not added until Android support library 25. In other words, if the official bottomnavigationview control is used, targetsdkversion must be > = 25, so as to introduce compatibility packages above version 25.

Next, let's see how to use bottomnavigationview.

To use bottomnavigationview, you need to add a dependency on the design compatibility package.

Create an XML file in the RES / menu / directory (if there is no such directory, manually create one). I name it navigation.xml. The image resources used in it are all provided by the system. This file is used to define the specific information of navigation items.

Each item represents an item in the bottom navigation, icon is an icon, and title is text. Then modify the activity layout

Bottomnavigationview has several special properties, * itembackground entry background * color rendered by itemicotint icon * color of itemtextcolor text * menu is associated with the menu created above

Finally, modify the bottomnavigationviewactivity code

Note * the default height of the bottom navigation bar is 56dp * the recommended menu is 3-5

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.

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
分享
二维码
< <上一篇
下一篇>>