I want the 4.0+ overflow menu to be used on pre ICS devices (2.3 - 2.1). I'm using HoloEverywhere with ActionBarSherlock.
I tried the following solution:
ActionBarSherlock & HoloEverywhere - Forcing Overflow?
but it does not work because absForceOverflow
does not exist. Was it removed in the newest version or something? I've checked the R
files of both ABS and HE library projects and the field is simply not there.
My app's theme is set to @style/Holo.Theme.Sherlock.Light
and that is the theme that i was trying to inherit from and add the absForceOverflow
parameter set to true
.
Beginning from ActionbarSherlock 4.2 we've lost the ability to manage overflow menu visibility. To make it working, you need combine 2 approaches:
To force menu visibility for Android 3.x (honeycomb) and upper, you need use this hack + add check Android version:
public static final int DEVICE_VERSION = Build.VERSION.SDK_INT;
public static final int DEVICE_HONEYCOMB = Build.VERSION_CODES.HONEYCOMB;
if (DEVICE_VERSION >= DEVICE_HONEYCOMB)
// Code from answer above
Open menu for pre-honeycomb devices:
ActionBarSherlock/src/com/actionbarsherlock/internal/view/menu/ActionMenuPresenter.java
, go to method reserveOverflow
Replace the original with:
public static boolean reserveOverflow(Context context) { return true; }
This will force menu showing ...
but when click on menu button menu popup not showing. To achieve this we need override this in your activity class:
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (DEVICE_VERSION < DEVICE_HONEYCOMB) {
if (event.getAction() == KeyEvent.ACTION_UP &&
keyCode == KeyEvent.KEYCODE_MENU) {
openOptionsMenu();
return true;
}
}
return super.onKeyUp(keyCode, event);
}
After this actions you should have absolutely working overflow action bar menu for all Android versions.