Android Question AppCompat : how to display the slide menu in the right side?

M.LAZ

Active Member
Licensed User
Longtime User
i try to change it by

B4X:
sm.Mode = sm.RIGHT ' LEFT

but the hamburger icon still in the left side...
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is no relation between AppCompat and SlidingMenu.

In the example you are talking about the hamburger icon is created with this code:
B4X:
ToolbarHelper.UpIndicatorDrawable = BitmapToBitmapDrawable(LoadBitmap(File.DirAssets, "hamburger.png").Resize(32dip, 32dip, True))
The up indicator is always in the left side.

You can show the hamburger icon on the right side.

1. Make sure that there are no overflow menu items.
2. Add it as a menu item:
B4X:
Sub Activity_CreateMenu(Menu As ACMenu)
   Menu.Clear
   Dim bd As BitmapDrawable = BitmapToBitmapDrawable(LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True))
   Dim item2 As ACMenuItem = ACToolBarLight1.Menu.Add2(0, 0, "right menu", bd)
   item2.ShowAsAction = item2.SHOW_AS_ACTION_ALWAYS
End Sub
 
Upvote 0

M.LAZ

Active Member
Licensed User
Longtime User
B4X:
Sub Activity_CreateMenu(Menu As ACMenu)
    Menu.Clear
'    Menu.Add(0, 0, "Overflow1", Null)
'    Menu.Add(0, 0, "Overflow2", Null)
'    Menu.Add(0, 0, "Overflow3", Null)
' 
    Dim item As ACMenuItem = ACToolBarLight1.Menu.Add2(0,0, "cart", Null)
    item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
    UpdateIcon("cart", AddBadgeToIcon(cartBitmap, badge))

    Dim bd As BitmapDrawable = BitmapToBitmapDrawable(LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True))
    Dim item2 As ACMenuItem = ACToolBarLight1.Menu.Add2(0, 0, "right menu", bd)
    item2.ShowAsAction = item2.SHOW_AS_ACTION_ALWAYS
  
End Sub
now i have two hamburger icons .. when i clicked in the right icon there is no action(the sliding menu doesn't appear) , and how to replace the left hamburger icon with cart icon?
thanks Erel..
 
Upvote 0
Top