Material-components-android: [BadgeDrawable] capability to add badges on custom views, image view, etc.

Created on 16 Jul 2019  路  15Comments  路  Source: material-components/material-components-android

Description.
Add badge on ImageViews, or other custom views.

feature request

Most helpful comment

Resolved in 5e35d14

rolledback in 0f717f8, rolled forward in 9487c33

All 15 comments

Hi @raquezha thank you for your interest in the badging feature, as noted in the javadoc, this feature is currently under development.

Could you please explain your intended use case?

I have a framlelayout which simulates the toolbar, inside it I have:

  1. Back button (ImageButton) [Left]
  2. Logo (ImageView) [Center]
  3. Cart icon (ImageView)[Right].
  4. Clear Cart Icon (ImageVIew) [Left of Cart Icon]

Use Case: Every time a user pick an item want to put:

  1. A _Badge with Number_ on the upper right part of the Cart Icon,
  2. When the user click the clear cart button then Remove the _Badge with Number_
  3. When the user adds another item, just increment the current badge number.

Also does this include adding badge on menu items or I should create another request? or just edit the title?

What kind of menu items?

There are multiple types of menus in that link: options menu, popup menu, contextual menus, based o your comment, I assume you mean option menu?

Sorry about that. Yes I'm referring to Option Menu.

thank you!

when can i use the badge,

@xsxkair what's your use case?

Hey, this would be a great feature! I need the excact use case reported by @raquezha for the option menu cart.

There are currently no plans to explicitly support badging on option menus, however, I think you may be able to create a custom layout which contains a badgeDrawable and set it via app:actionLayout

Are there any plans to support drawable background instead of color?
Are there missing customizable strokeWidth/strokeColor attributes? Would be great to have one of the options:

  • customize entire badge background with drawable
  • set strokeWidth & strokeColor (for internal shape drawable)

What would you recommend?

Resolved in 5e35d14

rolledback in 0f717f8, rolled forward in 9487c33

Woah! nice thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KelvinPac picture KelvinPac  路  3Comments

ahmaducg picture ahmaducg  路  3Comments

gabrielemariotti picture gabrielemariotti  路  3Comments

mnayef95 picture mnayef95  路  3Comments

TdevM picture TdevM  路  3Comments