0

We switching back to showing Actionbar


(source: android.com)

But [3] action overflow menu is not shown (in Android 4.3, Samsung Note 2).

<uses-sdk
    android:minSdkVersion="15"
    android:targetSdkVersion="19" />

Activity class extends android.app.Activity (not ActionBarActivity)

I played to even setting all menu item to have android:showAsAction="never" (In that case no actions are on ActionBar)

Docs

Similar questions when using appcompat support library

EDIT common_actions.xml has all actions as android:showAsAction="never"

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

    <item
        android:id="@+id/action_home"
        android:icon="@drawable/ic_default_image"
        android:showAsAction="never"
        android:title="@string/recommend"
        />
    <item
        android:id="@+id/action_downloadmanager"
        android:icon="@drawable/icon_personal_light_download_manage"
        android:showAsAction="never"
        android:title="@string/downloadmanage"
        />
    <item
        android:id="@+id/action_search"
        android:icon="@drawable/ic_action_search"
        android:showAsAction="never"
        android:title="@string/search"
        />
    <item
        android:id="@+id/action_settings"
        android:icon="@drawable/ic_action_settings"
        android:showAsAction="never"
        android:title="@string/setting"
        />

</menu>
Glorfindel
  • 21,988
  • 13
  • 81
  • 109
Paul Verest
  • 60,022
  • 51
  • 208
  • 332

3 Answers3

3

This is a Samsung thing that's actually a reaaaaallly stupid UI decision in my opinion. Within Touchwiz for all versions AFAIK overflow in the ActionBar isn't supported, instead you have to hit the bottom left button where a Gingerbread-esque menu pops up.

enter image description here

With Toolbar in AppCompat though you can override that behaviour and it shows a normal overflow in your ActionBar, I wrote a short post about moving from ActionBar to Toolbar that you can check out here, which contains links to more resources.

Derek
  • 632
  • 2
  • 11
  • 29
  • OK, so there is Samsung Touchwiz related issues. In the question I pointed that AppCompat is not used. Nice piece of info but not answer. – Paul Verest Feb 15 '15 at 08:59
  • AppCompat is used, but you're not targeting Lollipop or using Toolbar instead of ActionBar which would solve your issue. Sorry if I didn't word that clearly. – Derek Feb 15 '15 at 09:02
  • > Activity class extends android.app.Activity (not ActionBarActivity). Thanks anyway – Paul Verest Feb 15 '15 at 09:02
0

Looking further I have found a similar question https://stackoverflow.com/questions/23906985/action-overflow-button-not-shown (and here too)

that actually lead to several options inside Android action bar not showing overflow

I went with

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    makeOverflowMenu();
}

private void makeOverflowMenu() {
    //devices with hardware menu button don't show action overflow menu
    try {
        ViewConfiguration config = ViewConfiguration.get(this);
        Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
        if (menuKeyField != null) {
            menuKeyField.setAccessible(true);
            menuKeyField.setBoolean(config, false);
        }
    } catch (Exception e) {
        Log.d(TAG, e.getLocalizedMessage());
    }
}

Hardware menu button on Samsung Note 2 acts as if ActionBar action overflow menu was pressed.

Community
  • 1
  • 1
Paul Verest
  • 60,022
  • 51
  • 208
  • 332
0

That is correct behavior.

If you have a physical menu button (Samsung has it), Android will automatically hide the three dots. If you don't, it will show them.

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841