How can I configure the options menu so that there are only 2 buttons in the line?

I tried to configure my options menu so that in the 1st and 2nd line there were 2 buttons, and then 1 button in the third line. Here is the code I tried to use, but I assume that the groupID argument is not the way I thought.

menu.add(1, MENU_NAME, 1, "by Name"); menu.add(1, MENU_NUMBER, 2, "by Number"); menu.add(2, MENU_POSITION, 1, "by Position"); menu.add(2, MENU_COLLEGE, 2, "by College"); menu.add(3, MENU_UPDATE, 1, "Update Roster"); 

Perhaps this was somehow solved using an XML layout, but I am not very good at layouts (so I also did not manage to go too far.

+4
source share
2 answers

I do not believe that this is possible. A maximum of 6 items from the menu can be displayed at a time, and they will always be displayed in a maximum of 2 lines. Menu groups are just a way to refer to menu items together in code, they have no visual effect. See menu groups .

+4
source

I came to this topic, looking for a solution to the opposite problem. I have 3 lines when I want 2. I added all my menu options with an ordinal value like Menu.NONE and it is laid out in 3 rows so you can try. You can still control the order in the order in which you add the () element.

As a side element: this was not until I added the order value, which the menu began to lay out in 2 lines instead of 3.

+2
source

All Articles