-2

When you put a lot of action items on the action bar, some of them get to be inserted into the overflow menu, or become available by clicking on the menu button (if present).

Is there a way to be notified when this occurs? Maybe even know which items got to be into the overflow menu (or available via the menu button) ?

Again, I don't ask how to put items there and I don't need to get explanation about how to define action items. I ask how to know when and which items get to be there.

android developer
  • 114,585
  • 152
  • 739
  • 1,270
  • do you want to know that how to keep some action items always inside overflow menu ? Did I get you correctly ? – Dig May 23 '14 at 11:46
  • This is not what I asked about. I asked how to know when and which action items get to be there. – android developer May 23 '14 at 12:06
  • It takes them sequentially the way you have ordered them in the menu.xml file. I had six items the first one was to be shown always, second one ifRoom and rest never. On most of the devices it displayed the first item in the action bar directly and the rest in the same sequence they were inside my xml file in the overflow menu button. – Atul O Holic May 23 '14 at 12:16
  • @AtulOHolic My question is how to get notified about it in code. For example, how to make a function that will check which of them got to be shown and which aren't. – android developer May 23 '14 at 14:04

1 Answers1

0

You cannot decide which item to be into Action overflow menu but you can decide which to be shown always on Action bar.

You can also use "always" to declare that an item always appear as an action button. However, you should not force an item to appear in the action bar this way. Doing so can create layout problems on devices with a narrow screen. It's best to instead use "ifRoom" to request that an item appear in the action bar, but allow the system to move it into the overflow when there's not enough room. However, it might be necessary to use this value if the item includes an action view that cannot be collapsed and must always be visible to provide access to a critical feature.

http://developer.android.com/guide/topics/ui/actionbar.html

Vinayak Bevinakatti
  • 40,205
  • 25
  • 108
  • 139
  • I didn't ask for this. I asked how to know which items get to be there. – android developer May 23 '14 at 12:06
  • Since you asked `Maybe even know which items got to be into the overflow menu ` the above answer still explains the possibilities. – Vinayak Bevinakatti May 23 '14 at 12:09
  • I meant real code, that can tell you during runtime which action items are shown and which got to be hidden into the overflow menu. What you've written is something I already know, and describes how the layouting of the action items is performed when looking at the attributes of them. – android developer May 23 '14 at 14:06