I'm using app compact support library v7 for providing support of lollipop in my app. I was able to make it work perfectly. When my actionbar not showing menu items as icon.
I have followed this link to make it work .
Following is my menu.xml :
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/contact_add"
android:icon="@drawable/ic_btn_add_contact"
android:title="@string/add"
app:showAsAction="always"/>
<item
android:id="@+id/contact_delete"
android:icon="@drawable/ic_btn_add_contact"
android:showAsAction="never"
android:title="@string/delete"/>
</menu>
Still I am getting following error : should use android:showAsAction when not using appcompat library
What am I doing wrong ???
I solved this in following manner :
Go to
Build Path/Configure Build Path
and on theOrder and Export
tab,Do this for support library
android-support-v7-appcompat
also. Then justclean
your project and error is solved.Here is the link from where I get this.
Update your Menu Bar with this code
You are getting the error because you are using
You are supposed to write it as