attachBadgeDrawable

open fun attachBadgeDrawable(@NonNull badgeDrawable: BadgeDrawable, @NonNull anchor: View)


open fun attachBadgeDrawable(@NonNull badgeDrawable: BadgeDrawable, @NonNull anchor: View, @Nullable customBadgeParent: FrameLayout)

Attaches a BadgeDrawable to its associated anchor and update the BadgeDrawable's coordinates based on the anchor. For API 18+, the BadgeDrawable will be added as a view overlay. For pre-API 18, the BadgeDrawable will be set as the foreground of a FrameLayout that is an ancestor of the anchor.


open fun attachBadgeDrawable(@NonNull badgeDrawable: BadgeDrawable, @NonNull toolbar: Toolbar, @IdRes menuItemId: Int)

A convenience method to attach a BadgeDrawable to the specified menu item on a toolbar, update the BadgeDrawable's coordinates based on its anchor and adjust the BadgeDrawable's offset so it is not clipped off by the toolbar.

Menu item views are reused by the menu, so any structural changes to the menu may require detaching the BadgeDrawable and re-attaching it to the correct item.


open fun attachBadgeDrawable(@NonNull badgeDrawable: BadgeDrawable, @NonNull toolbar: Toolbar, @IdRes menuItemId: Int, @Nullable customBadgeParent: FrameLayout)

Attaches a BadgeDrawable to its associated action menu item on a toolbar, update the BadgeDrawable's coordinates based on this anchor and adjust the BadgeDrawable's offset so it is not clipped off by the toolbar. For API 18+, the BadgeDrawable will be added as a view overlay. For pre-API 18, the BadgeDrawable will be set as the foreground of a FrameLayout that is an ancestor of the anchor.

Menu item views are reused by the menu, so any structural changes to the menu may require detaching the BadgeDrawable and re-attaching it to the correct item.