53

I am implementing ActionBar to set the color for text using this style script in xml but getting error when I run my application time does anybody have idea what I have missing

this is my style.xml file

<!-- Start with the Holographic Light theme -->
<style name="Theme.IOSched" parent="android:style/Theme.Holo.Light">
    <item name="android:windowBackground">@drawable/window_background</item>
    <item name="android:actionBarStyle">@style/ActionBar</item>

    <!-- custom attributes 
    <item name="textHeaderMaxLines">@integer/text_header_max_lines</item>
    <item name="trackAbstractMaxLines">@integer/track_abstract_max_lines</item>-->
</style>

<style name="Theme.IOSched.Home" parent="style/Theme.IOSched">
    <item name="android:windowBackground">@drawable/window_background_home</item>
    <item name="android:actionBarStyle">@style/ActionBar</item>
</style>

<style name="ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
    <item name="android:background">@color/actionbar_background</item>
    <item name="android:textColor">@color/accent_1</item>
    <item name="android:titleTextStyle">@style/ActionBarText</item>
</style>

<style name="ActionBarText" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title"> <!-- getting here error-->
    <item name="android:textColor">@color/accent_1</item>
    <item name="android:textStyle">bold</item>
</style>

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Widget.ActionBar.Title'.
Pratik
  • 30,639
  • 18
  • 84
  • 159
  • 1
    Did you set your Build Target to 3.0 in Project Properties? – Ovidiu Latcu Dec 21 '11 at 13:28
  • 1
    I am having this error when playServices is not included and android:value="@integer/google_play_services_version" is giving error – Zar E Ahmer Jan 14 '15 at 06:34
  • See my answer on question [appcompat_v7: Error retrieving parent for item: No resource found that matches the given name](http://stackoverflow.com/questions/23231174/appcompat-v7-error-retrieving-parent-for-item-no-resource-found-that-matches-t/33052594#33052594) – hfmanson Oct 10 '15 at 09:48
  • 1
    See my answer on question [appcompat_v7: Error retrieving parent for item: No resource found that matches the given name](http://stackoverflow.com/questions/23231174/appcompat-v7-error-retrieving-parent-for-item-no-resource-found-that-matches-t/33052594#33052594) – hfmanson Oct 10 '15 at 09:50
  • See my answer on question [appcompat_v7: Error retrieving parent for item: No resource found that matches the given name](http://stackoverflow.com/questions/23231174/appcompat-v7-error-retrieving-parent-for-item-no-resource-found-that-matches-t/33052594#33052594) – hfmanson Oct 10 '15 at 09:51

7 Answers7

80

TextAppearance.Holo.Widget.ActionBar.Title appears to have been added in API Level 13. Make sure your build target is set to 13, not just 11.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • 29
    Silly to have to mention this, but I forgot the step so perhaps it will help someone else, too: don't forget to "Clean" the project after changing your project's target version! – Brian Lacy Jan 23 '12 at 19:38
16

AndroidManifest.xml:

<uses-sdk
    android:minSdkVersion=...
    android:targetSdkVersion="11" />

and

Project Properties -> Project Build Target = 11 or above

These 2 things fixed the problem for me!

WindRider
  • 11,958
  • 6
  • 50
  • 57
8

I tried to change target sdk to 13 but does not works!! then when I changed compileSdkVersion 13 to compileSdkVersion 14 is compiled successfully :)

NOTE: I Work with Android Studio not Eclipse

Khaled AbuShqear
  • 1,230
  • 14
  • 24
4

Make sure you've set your target API (different from the target SDK) in the Project Properties (not the manifest) to be at least 4.0/API 14.

Harshal Benake
  • 2,391
  • 1
  • 23
  • 40
  • This one is perfect. Upvoted. It would be great if you explain some more which can help us to understand better. – VVB Oct 17 '15 at 11:09
1

This happens because in r6 it shows an error when you try to extend private styles.

Refer to this link

Mind Peace
  • 905
  • 8
  • 29
alex
  • 477
  • 2
  • 7
  • 17
0
<style name="Theme.IOSched" parent="android:style/Theme.Holo.Light">
    <item name="android:windowBackground">@drawable/window_background</item>
    <item name="android:actionBarStyle">@style/ActionBar</item>
</style>

you can not give your own color and backgroud in item windowBackground. give your color in your /color.xml file.

Muhammad Aamir Ali
  • 20,419
  • 10
  • 66
  • 57
0

This is an old post, but if anyone comes up with this problem, i post what solved my problem:

I was trying to add the Action Bar Sherlock to my proyect when i get the error:

Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.ActionBar'.

I turns out that the action bar sherlock proyect and my proyect had differents minSdkVersion and targetSdkVersion. Changing that parameters to match in both proyect solved my problem.

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/>
sdsc81
  • 570
  • 8
  • 18