Skip to content Skip to sidebar Skip to footer

Dynamic Drawable Icon For Actionbar Menu Item? (android, Actionbarsherlock)

How can I dynamically update the icon for an ActionBar MenuItem to show a 'red badge' with a number? (conceptually similar to 'unread message count') I'm using ActionBarSherlock in

Solution 1:

There are a lot of ways to do this:

  1. Use LayerDrawable and stack badge images on top of your icon image.
  2. Write a custom class which extends from Drawable and draws the icon and badge manually.
  3. Use a custom action item view with your icon in an ImageView with a TextView overlay for the badge.

Post a Comment for "Dynamic Drawable Icon For Actionbar Menu Item? (android, Actionbarsherlock)"