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

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值