Matt Hirdler
Matt Hirdler

Reputation: 95

Error in Main.xml

I am getting the error: error: No resource identifier found for attribute 'showAsAction' in package:

I cannot find out why I am getting this error but I have been at it for hours without any sort of break through. I have searched google with many different resolutions but none that appear to work for me.

I would be grateful if someone could help direct me towards a fix to the error.

<menu xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context="org.nibbler.zoe.liteplayer.MainActivity" >

<item
        android:id="@+id/action_settings"
        android:orderInCategory="100"
        android:title="@string/action_settings"
        app:showAsAction="never"/>

</menu>

Upvotes: 0

Views: 233

Answers (2)

Manmohan Badaya
Manmohan Badaya

Reputation: 2336

If u are having min ver below 14 and u want to add showAsAction for below 14 api devices, then u can use this.

1.)U need support library to be added in build path.

2.)Need to add app theme as Theme.appcompat.

3)Rest are as u are using means add ur own namespace with .../res-auto value and use that name with showAsAction

You can add support lib res like this http://developer.android.com/tools/support-library/setup.html

You need to extends ActionBarActivity instead of Activity.

For complete Action bar guide follow the link http://developer.android.com/training/basics/actionbar/setting-up.html

Upvotes: 0

Marcin Orlowski
Marcin Orlowski

Reputation: 75629

Most likely showAsAction is not your attribute, hence not available in app: namespace. Did you mean android:showAsAction?

Upvotes: 2

Related Questions