Good afternoon, Colleagues. Can you please tell me how to implement this functionality? enter image description here

Application for online store. You need to make a basket icon in which is shown how many products are in it now. I have no idea how to do it at all, how even to google it like that)) If anyone did this, please tell me: 1. How can this be done - use the menu or in the toolbar markup or AppBarLayout to cram it? 2. Maybe there are some ready-made methods?

    1 answer 1

    There is a ready-made library ActionItemBadge or similar .

    You can also implement such a View yourself by assembling from two ImageView and placing them in a FrameLayout container.

    • If you assemble yourself, clicking on the item does not work. Implemented through: final MenuItem menuItemAddShoppingCart = menu.findItem (R.id.action_add_to_shopping_cart); menuItemAddShoppingCart.setOnMenuItemClickListener (new MenuItem.OnMenuItemClickListener () {...}; How can I solve this? - Valeriy