简体   繁体   中英

Android ActionBar - No Resource for attribute showAsAction despite API lvl 14

I've been working to integrate an Actionbar into my project and can't find the solution for my problem: I'm working with API Version 14 (set in Android Build Target & Manifest File, also cleaned afterwards) and nevertheless my menu xml file says the following error: error: No resource identifier found for attribute 'showAsAction' in package 'com.freelaxing.yamas' Does anybody have a clue what's going on here?

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

Why do you even need yourapp:showAsAction="ifRoom" ? If I'm not wrong this should be used only with ActionBarCompat from appcompat-v7 lib. And you do not need one because of targeting for API 14.

So, just try to remove two lines with yourapp:showAsAction="ifRoom" and XMLNS definition xmlns:yourapp="http://schemas.android.com/apk/res-auto" from root tag.

You might be check your project-properties file. (target=android-14)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM