How to add badges on Toolbar MenuItem Icons

后端 未结 2 971
天命终不由人
天命终不由人 2021-01-31 11:17

I tried to find an answer for myself but couldn\'t find it.

I need make badge on the MenuItem icon in the Toolbar, like this:

How can I make this?

2条回答
  •  借酒劲吻你
    2021-01-31 12:11

    I think it is possible with :

     
    
        
    

    And then using it for that icon as background.also, you need to remove/disable the default icon too.

    You may want to take a look:

    Remove App Icon from Navigation Drawer ActionBar Does not work

    Remove the navigation drawer icon and use the app icon to open

    https://stackoverflow.com/a/29160904/4409113

    Also, in the android-sdk/platforms/android-22/data/res, there should be that icon. You just need to find that and use it for your purpose (for example, adding that ImageView and adding it asbackground)

    Take a look: https://stackoverflow.com/a/34999691/4409113

提交回复
热议问题