PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 7, 2022

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

 November 07, 2022     android, android-optionsmenu, button, menu     No comments   

Issue

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.


Solution

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.



Answered By - Cheryl Simon
Answer Checked By - Katrina (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing