Just a wrong XML namespace! Try with:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
</menu>
And as G.T. suggested you should consider using appcompat on the showAsAction
property (only needed if you want to support API < 11):
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/item1"
android:icon="@drawable/ic_launcher"
app:showAsAction="ifRoom|withText"
android:title="@string/Add_New" />
</menu>
Note:
The appcompat library is compatible with some old Android versions (API 7+) that can't handle the showAsAction
property because they don't have the ActionBar
(API < 11).