error:no resource identifier found for attribute“showAsAction” in package android

不打扰是莪最后的温柔 提交于 2019-12-05 10:47:38

This attribute is introduced in API level 11. Check the min and target version of your app in Manifest file.

Dhanesh

"ShowAsAction" attribute is introduced in api 11. Change the minSdkVersion of your app in Manifest file.

If you want to use it for api lower than 11, then you have to use android support library "android.support.v4.app".

After importing support library, you have to make some changes in your login.xml file. for e.g replace "android:showAsAtion attribute" by "yourapp:showAsAction" and define "yourapp" in header in this way.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:yourapp="http://schemas.android.com/apk/res-auto" >
<item
    android:id="@+id/action_settings"
    android:orderInCategory="100"
    yourapp:showAsAction="never"
    android:title="@string/action_settings"/>
</menu>

Just remove android:showAsAction from xml file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!