-1

I need to add a textview dynamically in the centre on top of a basket icon in the action bar (see pic below). Each time a user adds an item to basket, that textview will be updated to show subtotal amount in the basket.

When the basket is empty, just the basket icon is displayed. The textview will be added the first time a user adds an item to the basket. If the basket gets empty, the textview will be removed

If anyone could help.

Thanks

action bar with textview overlay

john doe
  • 23
  • 6

1 Answers1

0

Please, check out this post How to display custom view in ActionBar?. You can create a custom view for it with an ImageView at background and a TextView in foreground. You can save a reference of this custom view when you inflate it, add it to your action bar and update it whenever you need. Hope it helps

Community
  • 1
  • 1
Augusto Carmo
  • 4,386
  • 2
  • 28
  • 61