MaterialDrawer icon indicating copy to clipboard operation
MaterialDrawer copied to clipboard

Add badge color

Open javiersantos opened this issue 11 years ago • 3 comments

How can be added the badge background color as appears in the screenshot?

Thanks and awesome update!

Badge color

javiersantos avatar Aug 24 '15 23:08 javiersantos

Hi Javier,

You can find it in the sample app. But I'll explain it for you:

Define two colors; the backgroundColor you want and a pressedColor you'll see when you press the Item.

Then create a BadgeStyle:

BadgeStyle badgeStyle = new BadgeStyle(backgroundColor, pressedColor).withTextColor(Color.WHITE);

And then apply that badgeStyle to your Items. For example:

 new PrimaryDrawerItem().withBadgeStyle(badgeStyle).withBadge("10")

echthard avatar Aug 25 '15 03:08 echthard

@echthard thanks for answering.

mikepenz avatar Aug 25 '15 06:08 mikepenz

Nice! Thanks @echthard.

javiersantos avatar Aug 25 '15 07:08 javiersantos