A AHilton Active Member Licensed User Longtime User Oct 14, 2018 #1 Can you use the XUI Badger with the AppCompat ACToolBarLight menu item? Yes, there's a badging example in that AppCompat example but I'd like to use the new XUI Badger to do this, if possible. I've tried … B4X: Dim Item As ACMenuItem = ACToolBarLight1.Menu.GetItem(0) ' 0 = The menu item I'm wanting the badge set onto Badger1.SetBadge(Item, 7, 0, 0) … but am getting this error … B4X: java.lang.ClassCastException: android.support.v7.view.menu.MenuItemImpl cannot be cast to android.view.View
Can you use the XUI Badger with the AppCompat ACToolBarLight menu item? Yes, there's a badging example in that AppCompat example but I'd like to use the new XUI Badger to do this, if possible. I've tried … B4X: Dim Item As ACMenuItem = ACToolBarLight1.Menu.GetItem(0) ' 0 = The menu item I'm wanting the badge set onto Badger1.SetBadge(Item, 7, 0, 0) … but am getting this error … B4X: java.lang.ClassCastException: android.support.v7.view.menu.MenuItemImpl cannot be cast to android.view.View
Erel B4X founder Staff member Licensed User Longtime User Oct 15, 2018 #2 XUI Badger works by adding a panel to the target view parent. This will not work with menu items. You need to use a similar approach as done here: https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#post-509530 Create a bitmap with the badge and use it as the menu icon. Upvote 0
XUI Badger works by adding a panel to the target view parent. This will not work with menu items. You need to use a similar approach as done here: https://www.b4x.com/android/forum/threads/appcompat-with-toolbar-minimal-example.79896/#post-509530 Create a bitmap with the badge and use it as the menu icon.