开发者

How can I set my options menu up so that there are only 2 buttons per row?

I was trying to set up my options menu so that there would be 2 buttons on the 1st and 2nd row and then 1 button on the 3rd row. Here is the code I was trying to use but I'm guessing groupID argument isn't what I thought it was.

  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");

Maybe this is solved somehow with the XML Layout but I'm not really good with the layouts ;( So I managed to not get too far that way either.


I don't believe that is possible. A max of 6 items from a menu can be visible at one time, and they will always show up in a max of 2 rows. Menu groups are just a way of being able to refer to menu items collectively in code, they do not have any visual effect. See menu groups.


I came to this thread while searching for the solution to the opposite problem. I have 3 rows when I want 2. I added all of my menu options with the order value as Menu.NONE and it laid out in 3 rows, so you could try that. You can still control the order by the order in which you add() the item.

As a sidenote: It wasn't until I added a order value that the menu starting laying out in 2 rows instead of 3.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜