0

I have a toolbar menu with two items that should appear in the overflow menu as per http://developer.android.com/training/basics/actionbar/adding-buttons.html

But these two appear in the bottom left button menu.

I'm using the following API levels:

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="21" />

The menu:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <item
        android:id="@+id/action_search"
        android:title="@string/action_search"
        android:orderInCategory="10"
        android:showAsAction="ifRoom"
        android:icon="@drawable/ic_search"/>
    <item
        android:id="@+id/action_copy"
        android:title="@string/action_copy"
        android:orderInCategory="10"
        android:showAsAction="ifRoom"
        android:icon="@drawable/ic_content_copy"/>
    <item
        android:id="@+id/action_share"
        android:title="@string/action_share"
        android:orderInCategory="10"
        android:showAsAction="never"
        android:icon="@drawable/ic_share"/>
    <item
        android:id="@+id/help"
        android:title="@string/help"
        android:orderInCategory="10"
        android:showAsAction="never"
        android:icon="@drawable/ic_help"/>

</menu>

The application:

<application
    android:allowBackup="true"
    android:label="@string/app_name"
    android:icon="@drawable/ic_launcher"
    android:theme="@android:style/Theme.Holo.Light">
Stephane
  • 11,836
  • 25
  • 112
  • 175

1 Answers1

0

From Android 4.4, whether or not device has menu hardware button, there will be overflow icon in ActionBar.

For previous versions, to force show of overflow icon, see this solution

Community
  • 1
  • 1
Max77
  • 1,466
  • 13
  • 19
  • The hack says it is only needed before Android 4.4. My question now is, is this Android 4.4 the one installed in the client device (and therefore independent of my will) or is it something I control with the API versions of my app ? – Stephane Jul 08 '15 at 19:05
  • I did the menu hack of Rino and it works fine. But having my two items from never to ifRoom shows them in the left bottom menu. I guess that is the normal behavior. – Stephane Jul 08 '15 at 19:34