material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[BadgeDrawable] Allow string in addition to int

Open hbb20 opened this issue 4 years ago • 9 comments

Is your feature request related to a problem? Please describe. BadgeDrawable can show a number on badge very easily. This capability can be extended for strings. This will be useful for some strings like "New" or "!".

Describe the solution you'd like Something like BadgeDrawable.setText().

hbb20 avatar Apr 17 '20 00:04 hbb20

Any news on this feature request yet? Would love for this to be implemented as all workarounds using custom layouts are currently quite a pain.

Thoromis avatar May 15 '20 09:05 Thoromis

Sorry, we are still waiting for design to conduct usability studies and provide guidance.

wcshi avatar May 15 '20 15:05 wcshi

This is a year old now, and we are having same need.

bpappin avatar Jun 09 '21 17:06 bpappin

I would like to see this implemented as well. Would like to support displaying 99+ for values > 99

alankley avatar Jun 09 '21 18:06 alankley

@alankley please try setting mtrl_badge_max_character_count to be 3, the default == 4

wcshi avatar Jun 10 '21 16:06 wcshi

Why is this so hard to approve and implement? How complicated can it be? We all need to add custom badge just because we need to set int instead of String. I also need to set 99+ if there are more than 99 notifications and in order to do that I need to add some workarounds that are not always good.

@wcshi is there any news about this?

Thanks in advance...

samardzija avatar Feb 10 '22 11:02 samardzija

I also need to set 99+ if there are more than 99 notifications this is currently supported, set maxCharacterCount to 3 instead of 4 (default) and when there are more than 99 notifications the badge text will display "99+" instead.

wcshi avatar Feb 10 '22 15:02 wcshi

Thanks @wcshi, I somehow missed that comment. Thanks for the help again, you saved me a bunch of time.

samardzija avatar Feb 11 '22 08:02 samardzija

save my day! On 8 Aug 22,we are still waiting for the feedback.

Joovo avatar Sep 08 '22 09:09 Joovo