NickT NickT - 3 months ago 13
Android Question

Enabling menu button on a 4.2 (Jelly Bean ) device

I have recently started using Android Studio with an app that I ported from an Eclipse environment. I would like a soft menu button to appear on my 4.2 tablet.

Having read this blog post I cannot reproduce this behaviour

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.


I find that I have to set the targetSDK to a value less than 11, as a value of 12 or 15 with no ActionBar does not produce a menu button.

Am I correct in assuming that the blog post is now incorrect?

Answer

Am I correct in assuming that the blog post is now incorrect?

No. Here is the relevant prose from the blog post:

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

12 is higher than 11. 15 is higher than 11. Hence, the system will not the Legacy Menu Button of Shame.

as a value of 12 or 15 with no ActionBar

A targetSdkVersion of 12 or 15 will have an action bar by default. If you are suppressing the action bar via a NoTitleBar theme or something similar, that does not impact the behavior of the Legacy Menu Button of Shame.