You are not using the correct attribute. I think Action Bar
docs explain this best.
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:yourapp="http://schemas.android.com/apk/res-auto" > <item android:id="@+id/action_search" android:icon="@drawable/ic_action_search" android:title="@string/action_search" yourapp:showAsAction="ifRoom" /> ... </menu>
Using XML Attributes from the Support Library
Note that the showAsAction attribute above uses its own namespace defined in the tag. This is necessary when using any XML attributes defined by the support library, since these attributes do not exist on the Android platform on older devices. Therefore, you should use your own namespace as a prefix for all attributes defined by the support library.
In other words, you need to change android:title
to yourCustomPrefix:title
<YourRootViewGroup xmlns:app="http://schemas.android.com/apk/res/org.seeingpixels.photon" xmlns:android="http://schemas.android.com/apk/res/android" ... > <android.support.v7.widget.Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="?attr/colorPrimary" android:minHeight="?attr/actionBarSize" app:title="@string/my_title" /> </YourRootViewGroup>
source share