thereisnospoon
thereisnospoon

Reputation: 255

Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'

I'm following the android development tutorials from developers.android.com, and currently I'm trying to style my action bar using the information given here: https://developer.android.com/training/basics/actionbar/styling.html#CustomBackground7

Here's the code of res/values/themes.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@android:style/Theme.AppCompat.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
        <!-- Support library compatibility -->
        <item name="actionBarStyle">@style/MyActionBar</item>

    </style>

    <!-- ActionBar styles -->
    <style name="MyActionBar"
           parent="@android:style/Widget.AppCompat.Light.ActionBar.Solid.Inverse">
        <item name="android:background">@drawable/actionbar_background</item>
        <!-- Support library compatibility -->
        <item name="background">@drawable/actionbar_background</item>

    </style>
</resources>

I see red cross icons beside the "style" opening tags, hovering on which the error message reads: error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Theme.AppCompat.Light.DarkActionBar'.

Please help. I've been at it since morning and I'm not getting anywhere.

Upvotes: 6

Views: 5831

Answers (1)

PavelGP
PavelGP

Reputation: 1939

Try to delete android:, like this:

<style name="CustomActionBarTheme"
       parent="@style/Theme.AppCompat.Light.DarkActionBar">

Upvotes: 10

Related Questions