1

I 've an action bar (from support.v7) with some Tabs, so far so good.

The problem is with the menus.

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

   <item
        android:id="@+id/action_m1"
         android:orderInCategory="100"
        android:showAsAction="always"
        android:icon="@drawable/ic_action_chat"
        android:title=""/>



    <item
        android:id="@+id/action_m2"
        android:orderInCategory="101"
        android:showAsAction="always"
        android:icon="@drawable/ic_action_merge"
        android:title="">
    </item>

</menu>

"always" is ignored. It never shows as an Action, it's shown only when I press the "menu". This happens even if I don't have any tabs loaded, and there is plenty of space.

What could be wrong, am I missing some call on the ActionBar?

Best Regards.

Michael Chourdakis
  • 10,345
  • 3
  • 42
  • 78

1 Answers1

4

You can't use the android namespace for the menu items when using the support library ActionBar. Instead, you need to prefix the attribute with your custom namespace:

// in the menu xml file
xmlns:name="http://schemas.android.com/apk/res-auto"

<item
    android:id="@+id/action_m1"
    android:orderInCategory="100"
    name:showAsAction="always"
    android:icon="@drawable/ic_action_chat"
    android:title=""/>

You can read more in the official guide.

user
  • 86,916
  • 18
  • 197
  • 190