3

It seems that people using devices with hardware menu button with less than Android Kitkat still don't get the menu button on the screen, even with the new r21/r22 appcompat library.

I guess it is determined by the internal ActionBarPolicy class:

public boolean showsOverflowMenuButton() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        return true;
    } else {
        return !ViewConfigurationCompat.hasPermanentMenuKey(ViewConfiguration.get(mContext));
    }
}

so forced overflow menu button is only on KitKat and above.

Is there any way to force the overflow menu to appear, even if the app runs on devices less than KitKat with hardware menu button?

Randy Sugianto 'Yuku'
  • 71,383
  • 57
  • 178
  • 228
  • General consensus is that you should just let the OS determine if it needs to show it, and that it's bad practice to force the overflow menu if the device has a hardware menu button. However, there is an answer in this post: http://stackoverflow.com/a/15493649/4409409 I haven't tested it so I'm not sure if it works. – Daniel Nugent Apr 01 '15 at 04:12

1 Answers1

0

In appcomt support library, use your own toolbar(which inflated from xml or created from code) replace default actionbar(in your ActionbarActivity call setSupportActionar(toolbar)), you' ll see the overflow menu(if you has set up menu).

test on android 2.3.x emulator.

longkai
  • 3,598
  • 3
  • 22
  • 24