2011-12-21 87 views
52

我采取动作条使用XML这种风格的脚本来设置文本的颜色,而是得到错误,当我运行我的应用程序时没有任何人有知道我已经失踪错误检索父的项目:无资源发现在给定名称匹配“@android:风格/ TextAppearance.Holo.Widget.ActionBar.Title”

这是我style.xml文件

<!-- 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'. 
+1

您是否在Project Properties中将您的Build Target设置为3.0? –

+0

是的,我把目标定 – Pratik

+1

我有这个错误时,不包含playServices和android:价值=“@整数/ GOOGLE_PLAY_SERVICES_VERSION”是给错误 – Nepster

回答

80

TextAppearance.Holo.Widget.ActionBar.Title似乎在API级别增加了13.确保您的构建目标设置为13,而不仅仅是11.

+29

愚蠢的不得不提到这一点,但我忘了这一步,所以也许它会帮助别人:不要忘记“干净“改变项目目标版本后的项目! –

+2

@BrianLacy,Eclipse并不傻。 – Pacerier

1

发生这种情况是因为在r6中,当您尝试扩展私有样式时,它显示错误。

请参阅本link

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> 

你不能给自己的颜色和研究背景的项目windowBackground。 在/color.xml文件中给出你的颜色。

16

的AndroidManifest.xml:

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

项目属性 - >项目构建目标 = 11或以上

这2个东西解决了问题我!

4

确保你设置你的目标API中的项目属性(不清单)(从目标SDK不同)至少为4.0/API 14

+0

这个是完美的。 Upvoted。如果你解释一些可以帮助我们更好地理解的东西,那将是很棒的。 – VVB

9

我试图目标SDK更改为13但不起作用! 然后当我改变compileSdkVersion 13compileSdkVersion 14成功编译:)

NOTE: I Work with Android Studio not Eclipse

+1

谢谢你。像魅力一样工作。 – Sush

0

这是旧的文章,但如果有人想出了这个问题,我发布了什么解决我的问题:

我试图添加操作栏福尔摩斯我proyect当我得到的错误:

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

我原来的操作栏福尔摩斯proyect和我proyect有型动物 minSdkVersion targetSdkVersion。在两个项目中更改参数以匹配解决了我的问题。

<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="17"/> 
相关问题