AppCompat_v7 Toolbar as actionbar not showing ‘always’ actions from menu, but API Toolbar does

Per the Action Bar training, you have to use the app:showAsAction attributes rather than the android:showAsAction attribute:

Notice that the showAsAction attribute above uses a custom namespace defined in the <menu> tag. This is necessary when using any XML attributes defined by the support library, because these attributes do not exist in the Android framework on older devices. So you must use your own namespace as a prefix for all attributes defined by the support library.

So your menu file should look like:

<menu xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:app="http://schemas.android.com/apk/res-auto" >
    <item
        android:id="@+id/action_test"
        app:showAsAction="always"
        android:icon="@drawable/ic_launcher"
        android:title="@string/action_settings"/>

    <item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        app:showAsAction="never"
        android:title="@string/action_settings"/>
</menu>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)