Ghost-Man
Ghost-Man

Reputation: 2185

No resource found that matches the given name: attr 'actionBarStyle'

I am trying to change the android action bar style. The minimum API support for the app is 8. So as using android:actionBarStyle attribute in the style xml file in the values folder gives the minimum required API 11 error, I have commented it out and moved it to a separate style xml file in v11 folder.

However, when using the actionBarStyle attribute only for android 2.1 and higher as mentioned in the android documentation, it gives me the No resource found error. Below is the style code:

<style name="AppTheme" parent="android:Theme.DeviceDefault">

        <item name="android:typeface">monospace</item>
<!-- <item name="android:actionBarStyle">@style/MyActionBarTheme</item> -->

    <!-- Support library compatibility -->
    <item name="actionBarStyle">@style/MyActionBar</item>

</style>

I have tried changing the style parent theme from DeviceDefualt to Holo.Light.DarkActionBar, AppCompat.Light.DarkActionBar, etc. but the error still remains.

Upvotes: 1

Views: 5661

Answers (1)

ianhanniballake
ianhanniballake

Reputation: 200130

If you want to use the standard Action Bar on Android devices v7 appcompat library, which backports the Action Bar to any API 7+ device when you use ActionBarActivity. (Note, the Android documentation you found reference this same library, hence the 'When using the Support Library' comments throughout that document)

To add it to your project, you can follow the directions for adding a library with resources for whatever IDE you use.

Once you have the appcompat library added, you may consider using a tool like the Android Action Bar Style Generator which automatically builds the correct styles/resources needed to fully style your action bar (make sure to change the 'Style Compatibility' drop down to 'AppCompat').

Upvotes: 1

Related Questions