在底部导航栏图标的顶部显示徽章 [英] Display badge on top of bottom navigation bar's icon
问题描述
I have implemented the bottom navigation view in my app and I have looked every where to display badges on top of the icons like this I was wondering whether this is even possible to implement. Any help is appreciated. Thank you.
推荐答案
在使用支持库底部导航栏时,它非常复杂,无法在菜单项上显示徽章/通知. 但是,有简单的解决方案可以完成它.如 https://github.com/aurelhubert/ahbottomnavigation
When using support library Bottom Navigation bar, its quite complex to show a badge/notification on menu items. However there are easy solutions to get it done. Such as https://github.com/aurelhubert/ahbottomnavigation
此库是底部导航"栏的更高级版本.您只需使用此代码段即可在菜单项上设置徽章.
This library is more advanced version of Bottom Navigation bar. And you can set a badge on menu item simply using this code snippet.
bottomNavigation.setNotification(notification, bottomNavigation.getItemsCount() - 1);
您将获得以下结果
这篇关于在底部导航栏图标的顶部显示徽章的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!