20151227-01 [工程配置] error: Error retrieving parent for item: No resource found that matches the give

来源:互联网 发布:2016网络穿越小说 编辑:程序博客网 时间:2024/05/30 07:13

1、直接删除parent=。。。

2、

转:http://www.devdiv.com/forum.php?mod=viewthread&tid=89826&page=1#pid557155

有时候在定义自己的style文件时会报:
error: Error retrieving parent for item: No resource found that matches the given name '@android:style/Widget.TextView.ListSeparator.White'.

我的style定义如下:
<style name="ListSeparator" parent="@android:style/Widget.TextView.ListSeparator.White">
        <item name="android:background">@drawable/light_header_dither</item>
        <item name="android:textColor">#ffEE2C2C</item>
</style>

提示错误大体是说,找不到我继承的style。
parent="@android:style/Widget.TextView.ListSeparator.White"表示继承系统的style。
查看源码可以看到系统定义如下:
    <style name="Widget.TextView">
        <item name="android:textAppearance">?android:attr/textAppearanceSmall</item>
        <item name="android:textSelectHandleLeft">?android:attr/textSelectHandleLeft</item>
        <item name="android:textSelectHandleRight">?android:attr/textSelectHandleRight</item>
        <item name="android:textSelectHandle">?android:attr/textSelectHandle</item>
    </style>

    <style name="Widget.TextView.ListSeparator.White">
        <item name="android:textColor">?textColorPrimaryInverse</item>
        <item name="android:background">@android:drawable/light_header_dither</item>
    </style>
但Eclipse只能链接到Widget.TextView这一层。
可能的原因是要不sdk没有这个style或者是这个style被设置为不公开的了。

对于非public的xml属性,可以在“@”后加个"*"解决,如下:

  1. <item name="android:windowTitleStyle">@*android:style/Widget.TextView.ListSeparator.White</item>
或者有一个比较笨的方法,就是把源码里的那个style复制过来放到自己的xml里然后引用

0 0