Skip to content Skip to sidebar Skip to footer

Android Actionbarsherlock Show Menu Button At Top

I am trying to implement ActionBarSherlock in my application and I need to show the menu at the top of my application, integrated in action bar. The problem is that it's not workin

Solution 1:

You can do an xml file line this. I saw this in some other post but I cannot track it rigth now.

<menuxmlns:android="http://schemas.android.com/apk/res/android" ><itemandroid:id="@+id/more"android:showAsAction="always"android:icon="@drawable/abs__ic_menu_moreoverflow_holo_dark"><menu><itemandroid:id="@+id/remove"android:showAsAction="withText|never"android:title="@string/remove"></item></menu></item></menu>

Then just inflate it like a normal menu.

publicbooleanonCreateOptionsMenu(Menu menu) {
        getSupportMenuInflater().inflate(R.menu.overlow, menu);
        returntrue;
    }

Solution 2:

From what I read in ActionbarSherlock's documentation you cannot force the menu icon to appear in Android 4.+. When the device has a menu button the menu icon does not appear. I guess the guy who wrote ActionbarSherlock knows the subject matter well ;-)

Solution 3:

Please read the dorjeduck's answer. If you want have same experience on all devices you have to add custom menu with his submenus. Here this the code sumple:

SubMenu sub = menu.addSubMenu("More");
sub.setIcon(R.drawable.abs__ic_menu_moreoverflow_holo_dark);
sub.add(0, MENU_SETTINGS, 0, "Settings");

Post a Comment for "Android Actionbarsherlock Show Menu Button At Top"