If you use Android Support, it will no work as below.
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/action_1"
android:icon="@drawable/ic_action_1"
android:showAsAction="ifRoom"
android:title="@string/menu_1"></item>
</menu>
Solution:
Add xmlns:app="http://schemas.android.com/apk/res-auto", and use app:showAsAction instead of android:showAsAction
<menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" >
<item android:id="@+id/action_1"
android:icon="@drawable/ic_action_1"
app:showAsAction="ifRoom"
android:title="@string/menu_undo"></item>
</menu>