3

I'm creating an Android app for version 2.3.3 and higher (using the same SDK version) and I have used a legacy menu button.

I also have used a custom ActionBar library that doesn't have the menu overflow (?) capability. So is there any way for me to display the menu on newer Android devices without the physical menu button? Preferably without having to change the ActionBar to use another library or without having to use Android's newer SDKs?

Thanks.

Rudi Visser
  • 21,350
  • 5
  • 71
  • 97
Roshnal
  • 1,284
  • 3
  • 16
  • 39
  • "I also have used a custom ActionBar library that doesn't have the menu overflow (?) capability." -- why? Why not use one that does have the overflow menu, like ActionBarSherlock? – CommonsWare Nov 10 '12 at 14:48
  • @CommonsWare I have some specific reasons for that... I knew about ActionBarSherlock. – Roshnal Nov 10 '12 at 15:09

2 Answers2

3

and I have implemented a legacy menu button

What for? Android would handle this by itself if your application is legacy one, it will add on-screen menu button on Honeycomb and up, so you just do not need to bother.

See this article: Say goodbye to menu button

If your app runs on a device without a dedicated Menu button, the system decides whether to add the action overflow to the navigation bar based on which API levels you declare to support in the manifest element. The logic boils down to:

If you set either minSdkVersion or targetSdkVersion to 11 or higher, the system will not add the legacy overflow button.

Otherwise, the system will add the legacy overflow button when running on Android 3.0 or higher.

The only exception is that if you set minSdkVersion to 10 or lower, set targetSdkVersion to 11, 12, or 13, and you do not use ActionBar, the system will add the legacy overflow button when running your app on a handset with Android 4.0 or higher.

Soft menu key for legacy app would look like this:

enter image description here

Marcin Orlowski
  • 72,056
  • 11
  • 123
  • 141
  • 1
    OK, so it will display a soft menu button on devices without a physical menu button (for ex: HTC One S), if I keep this as it is? – Roshnal Nov 10 '12 at 14:38
  • Yes. I added shot to the answer - these "dots" on right is the menu "key" – Marcin Orlowski Nov 10 '12 at 14:41
  • @Roshnal: "if I keep this as it is?" -- since we do not know what "as it is" actually is, it is impossible to answer that. If your `android:targetSdkVersion` is lower than 10 (or in other conditions as noted in the quoted passage in the answer), *then* you will get the menu affordance in the system or navigation bar. However, as soon as you raise `android:targetSdkVersion` high enough, you will lose that menu affordance and the user will not be able to access the overflow menu. – CommonsWare Nov 10 '12 at 14:52
  • @CommonsWare Please read my question- I think its pretty much clear that I don't have any kind of overflows, so its the old menu like in Android 2.3 - 2.2 devices. – Roshnal Nov 10 '12 at 15:06
  • 1
    @Roshnal: Ther "old menu like in Android 2.3 - 2.2 devices" is called the overflow menu on Android 3.0+. – CommonsWare Nov 10 '12 at 15:21
  • @CommonsWare Yeah, so the "old menu" will appear as an legacy overflow button (and not as an action overflow) on Android 3.0+ as stated by the link post and quoted by the answer. – Roshnal Nov 10 '12 at 15:25
  • @Roshnal: Only if (and so long as) your `android:targetSdkVersion` is set appropriately. – CommonsWare Nov 10 '12 at 15:27
  • @CommonsWare I have set it corresponding to Android 2.3.3 – Roshnal Nov 10 '12 at 15:59
0

You might also check a couple of my answers from the past few days. Both the questions are for ActionBarSherlock

Answer 1

Answer 2

NOTE: As also mentioned in both these answers, and I would like to reiterate. This is merely putting an option across for devs who would still like to force the OverFlow menu.

Community
  • 1
  • 1
Siddharth Lele
  • 27,623
  • 15
  • 98
  • 151
  • Thanks for answering, but I have used another small ActionBar library. Not ActionBarSherlock... – Roshnal Nov 10 '12 at 15:08