David Biga
David Biga

Reputation: 2801

Setting styles in Android

Hey guys I am new to development for the Android, I have a question for a project I am working on:

Using these styles to style my actionbar:

<resources>
    <!-- the theme applied to the application or activity -->
    <style name="CustomActionBarTheme"
           parent="@style/Theme.Holo.Light.DarkActionBar">
        <item name="android:actionBarStyle">@style/MyActionBar</item>
    </style>

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

I get an error for both styles, they say:

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

error: Error retrieving parent for item: No resource found that matches the given name '@style/
 Widget.Holo.Light.ActionBar.Solid.Inverse'.

I am putting these in a separate XML file called themes. In my style XML file I have the theme android:Theme.Light

If you could give me a suggestion or whatnot as to what is wrong here I would appreciate it!

David

Upvotes: 0

Views: 1962

Answers (1)

Raghunandan
Raghunandan

Reputation: 133560

"@style/Theme.Holo.Light.DarkActionBar"

You are referring to the styles in your values/styles.xml and you do not have the style mentioned in styles.xml. You probable meant to refer to the one in the android style package like @android:style/..

Change to

 <resources>
    <style name="CustomActionBarTheme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
             <item name="android:actionBarStyle">@style/MyActionBar</item>

    </style>

    <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
         <item name="android:background">@drawable/actionbar_background</item>

    </style> 
</resources>

Upvotes: 2

Related Questions