Skip to main content
highlighting
Source Link
Baker
  • 27.8k
  • 13
  • 107
  • 114

For Fragments

Menus with custom namespace will preventprevent showAsAction from showing.

Using "android:" prefix for showAsAction will work, even though Android Studio will remark you should use a custom name space.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_add_checkin"
          android:title="Add Checkin"
          android:orderInCategory="10"
          android:showAsAction="always"
        android:icon="@android:drawable/ic_menu_add"/>
</menu>

This is using Android SDK 22 and Support v4 fragments, in case that makes any difference.

For Fragments

Menus with custom namespace will prevent showAsAction from showing.

Using "android:" prefix for showAsAction will work, even though Android Studio will remark you should use a custom name space.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_add_checkin"
          android:title="Add Checkin"
          android:orderInCategory="10"
          android:showAsAction="always"
        android:icon="@android:drawable/ic_menu_add"/>
</menu>

This is using Android SDK 22 and Support v4 fragments, in case that makes any difference.

For Fragments

Menus with custom namespace will prevent showAsAction from showing.

Using "android:" prefix for showAsAction will work, even though Android Studio will remark you should use a custom name space.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_add_checkin"
          android:title="Add Checkin"
          android:orderInCategory="10"
          android:showAsAction="always"
        android:icon="@android:drawable/ic_menu_add"/>
</menu>

This is using Android SDK 22 and Support v4 fragments, in case that makes any difference.

Source Link
Baker
  • 27.8k
  • 13
  • 107
  • 114

For Fragments

Menus with custom namespace will prevent showAsAction from showing.

Using "android:" prefix for showAsAction will work, even though Android Studio will remark you should use a custom name space.

<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@+id/action_add_checkin"
          android:title="Add Checkin"
          android:orderInCategory="10"
          android:showAsAction="always"
        android:icon="@android:drawable/ic_menu_add"/>
</menu>

This is using Android SDK 22 and Support v4 fragments, in case that makes any difference.