样式TextAppearance.Holo未找到

时间:2011-09-26 15:11:04

标签: android styles

我一直在构建这个应用程序一段时间,并且在我今天更新到最新的平台工具之前没有遇到任何主题问题。现在它告诉我了

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Medium.Inverse'.
error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Medium'.
error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Large'.

error messages

这是我的styles.xml中导致问题的部分,但正如我所说,它在几个月内没有改变,直到今天仍然正常工作!

<style name="BD.TextAppearance.Medium.Inverse" parent="@android:style/TextAppearance.Holo.Light.Medium.Inverse">
    <item name="android:textColor">#FFF</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="BD.TextAppearance.Medium" parent="@android:style/TextAppearance.Holo.Light.Medium">
    <item name="android:textColor">#666666</item>
    <item name="android:textSize">16sp</item>
</style>

<style name="BD.TextAppearance.Large" parent="@android:style/TextAppearance.Holo.Light.Large">
    <item name="android:textColor">#666666</item>
    <item name="android:textSize">20sp</item>
</style>

- =编辑= - 我开始搞乱这些值,结果发现它确实找到了这些样式:

<style name="BD.TextAppearance" parent="@android:style/TextAppearance">
    <item name="android:textColor">#FFF</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="BD.TextAppearance.Medium.Inverse" parent="@android:style/TextAppearance.Medium.Inverse">
    <item name="android:textColor">#FFF</item>
    <item name="android:textStyle">bold</item>
</style>

但不是这些:

<style name="BD.TextAppearance" parent="@android:style/TextAppearance.Holo">
    <item name="android:textColor">#FFF</item>
    <item name="android:textStyle">bold</item>
</style>

<style name="BD.TextAppearance.Medium.Inverse" parent="@android:style/TextAppearance.Light.Medium.Inverse">
    <item name="android:textColor">#FFF</item>
    <item name="android:textStyle">bold</item>
</style>

2 个答案:

答案 0 :(得分:1)

我仍然不知道为什么会这样,但我找到了解决办法。我从Android SDK复制了styles.xml文件并将其粘贴到我的项目中,并取出了我没有使用的所有样式。我改变了所有'父'声明,包括'@android:'前缀,并在'?'之后添加'android:'对于所有属性。这允许它编译和运行。但就像我说的那样,我真的很想知道为什么它首先破裂了!

答案 1 :(得分:0)

error: Error retrieving parent for item: No resource found that matches the given name '@android:style/TextAppearance.Holo.Light.Medium.Inverse'.

我也面临同样的问题我所做的就是我删除了

parent="@android:style/TextAppearance.Holo.Light.Medium.Inverse"属性。它会检查它。