Android Question AppCompat menu

fishwolf

Well-Known Member
Licensed User
Longtime User
i'm using the last version of AppCompat library 3.20

B4X:
Sub Activity_CreateMenu(Menu As ACMenu)
   sv.Initialize2("Search", sv.THEME_DARK)
   sv.IconifiedByDefault = True

   'Clear the menu
  Menu.Clear

   'Add a menu item and assign the SearchView to it
   si = Menu.Add(1, 1, "Item1", Null)
   si = Menu.Add(2, 2, "Item2", Null)
   si = Menu.Add(3, 3, "Item3", Null)
   si = Menu.Add(4, 4, "Item4", Null)
   si = Menu.Add(5, 5, "Item5", Null)
   si.SearchView = sv
End Sub

i have notice that a item is present into the toolbar, the other items are into the menu.

is it possibible set/fix 2-3 items in toolbar and other items into menu.

Thanks
 

Attachments

  • itis.png
    29.6 KB · Views: 328
  • Iwant.png
    29.3 KB · Views: 295

corwin42

Expert
Licensed User
Longtime User
You can control with

B4X:
si.ShowAsAction=si.SHOW_AS_ACTION_IF_ROOM

if the items should show as action item or menu item. See the other SHOW_AS_ACTION constants for more possibilities.
 
Upvote 0

fishwolf

Well-Known Member
Licensed User
Longtime User

i have tried all SHOW_AS_ACTION constants, but none set item1 and item2 on actionbar and item3-4-5 on menu.
 
Upvote 0

corwin42

Expert
Licensed User
Longtime User
i have tried all SHOW_AS_ACTION constants, but none set item1 and item2 on actionbar and item3-4-5 on menu.

You have to set SHOW_AS_ACTION_IF_ROOM for item 1+2 and SHOW_AS_ACTION_NEVER for item 3+4+5.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…