0

In the same activity, I want to place some options in the optionsMenu and some on the ActionBarActivity. Should I create a separate xml file for the options to be placed in the optionsMenu and another xml file for those I want to place them on the ActionBar?

OR I have to create a single xml file for both? And in either cases, what will distinguish the options to be placed on the ActionBar than the others to be in the optionsmenu?

Amrmsmb
  • 1
  • 27
  • 104
  • 226

1 Answers1

0

Do you mean the action bar and its overflow area (i.e. the "three dots")?

You need to create a single xml file with all the menu options, and then control this with the android:showAsAction attribute on each one. For example, if you set ifRoom then it will be included in the action bar (provided there is enough space), while never will put the item in the overflow menu.

See the documentation here.

matiash
  • 54,791
  • 16
  • 125
  • 154
  • thank you. No, i do not mean `actionbar` and the rest of the options to reside inside the `overflow icon`. i mean some of the options to appear on the `actionbar` and some options in the `options menu` the menu that appear when you press the options button "the button on the lower left side of your device. – Amrmsmb Jun 18 '14 at 18:13
  • would you please, if you do not mind, take a look at that questionhttp://stackoverflow.com/questions/24286112/why-the-menu-items-appear-on-the-optionsmenu – Amrmsmb Jun 18 '14 at 18:16
  • @Elpharaoh It's the same. On devices with a physical menu button, the overflow menu is what is shown when you press it. – matiash Jun 18 '14 at 18:52