1

While i m trying to show 3 menu in overflow menu on sherlockactionbar but it not showing overflow icon , but when i press menu button from hardware it shows option at bottom of screen :

I m overriding menu through this in SherlockFragmentActivity

public boolean onCreateOptionsMenu(com.actionbarsherlock.view.Menu menu) {
            // TODO Auto-generated method stub
            MenuInflater inflater = getSupportMenuInflater();
            inflater.inflate(R.menu.activity_home, menu);

            return true;

        }

and in Menu xml i have also added android:showAsAction="never" property coding for that .xml:

<menu xmlns:android="http://schemas.android.com/apk/res/android" >

    <item
        android:id="@+id/menu_settings"
        android:icon="@android:drawable/ic_menu_info_details"
        android:showAsAction="never"
        android:title="about"/>

    <item
        android:id="@+id/menu_settings2"
        android:icon="@drawable/plusnew"
        android:showAsAction="never"
        android:title="Add"/>

    <item
        android:id="@+id/menu_settings3"
        android:icon="@drawable/tem2"
        android:showAsAction="never"
        android:title="Done"/>

</menu>
Nil
  • 55
  • 1
  • 10

2 Answers2

2

If your Phone has a HardwareButton for the Overflowmenu, it wont display the software button because you don't need it.

In this Case:

Not a Bug, its a feature :)

user2162545
  • 118
  • 4
0

Try,

public boolean onCreateOptionsMenu(Menu menu) {
    // Used to put dark icons on light action bar

    SubMenu subMenu1 = menu.addSubMenu("Share");

    subMenu1.add("Facebook").setOnMenuItemClickListener(
            new OnMenuItemClickListener() {

                public boolean onMenuItemClick(MenuItem item) {





                    return false;
                }
            });



    MenuItem subMenu1Item = subMenu1.getItem();
    subMenu1Item.setIcon(R.drawable.ic_share);
    subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS
            | MenuItem.SHOW_AS_ACTION_WITH_TEXT); //Note the flag SHOW_AS_ACTION_ALWAYS

    return true;
}
Basim Sherif
  • 5,384
  • 7
  • 48
  • 90
  • if you want to force the overflow button, even if there is a Hardwarebutton try this :) http://stackoverflow.com/questions/9286822/how-to-force-use-of-overflow-menu-on-devices-with-menu-button – user2162545 Sep 13 '13 at 12:04