异常:

Error:(128, 5) error: style attribute 'com.honghui0531.prebiotics.view:attr/item_right_icon_src' not found.

自定义属性文件 attrs.xml

    <!--自定义itemview的属性-->
<declare-styleable name="custromerItemView"> <!--左侧图片-->
<attr name="item_left_icon_src" format="reference"></attr>
<attr name="item_left_icon_width" format="integer"></attr>
<attr name="item_left_icon_height" format="integer"></attr>
<attr name="item_left_icon_visibility" format="enum">
<enum name="visible" value="0x00000000"></enum>
<enum name="invisible" value="0x00000004"></enum>
<enum name="gone" value="0x00000008"></enum> </attr> <!--中间文字-->
<!--左侧图片-->
<attr name="tv_item_content_text" format="reference"></attr>
<attr name="tv_item_content_text_color" format="reference"></attr>
<attr name="tv_item_content_text_size" format="integer"></attr> <attr name="tv_item_content_visibility" format="enum">
<enum name="visible" value="0x00000000"></enum>
<enum name="invisible" value="0x00000004"></enum>
<enum name="gone" value="0x00000008"></enum> </attr> <!--右侧图片-->
<attr name="item_right_icon_src" format="reference"></attr>
<attr name="item_right_icon_width" format="integer"></attr>
<attr name="item_right_icon_height" format="integer"></attr>
<attr name="item_right_icon_visibility" format="enum">
<enum name="visible" value="0x00000000"></enum>
<enum name="invisible" value="0x00000004"></enum>
<enum name="gone" value="0x00000008"></enum> </attr> <!--中间文字-->
<!--左侧图片-->
<attr name="tv_item_desc_text" format="reference"></attr>
<attr name="tv_item_desc_text_color" format="reference"></attr>
<attr name="tv_item_desc_text_size" format="integer"></attr> <attr name="tv_item_desc_visibility" format="enum">
<enum name="visible" value="0x00000000"></enum>
<enum name="invisible" value="0x00000004"></enum>
<enum name="gone" value="0x00000008"></enum> </attr>
</declare-styleable>

在style中使用,不用加限定即可

 <!--mine setting item -->
<style name="mineSettingItemStyle">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="tv_item_content_text_color">@color/black</item>
<item name="tv_item_desc_visibility">gone</item>
<item name="item_right_icon_src">@mipmap/more</item>
</style>

android在style中使用自定义属性 error: style attribute not found.的更多相关文章

  1. 【转】 Android xml中 @和?区别,style和attr小结

    引用资源时,使用@还是?的区别,例如在设置style的时候既可以使用@也可以使用? style="?android:attr/progressBarStyleHorizontal" ...

  2. Android应用开发中的风格和主题(style,themes)

    http://www.cnblogs.com/playing/archive/2011/04/01/2002469.html 越来越多互联网企业都在Android平台上部署其客户端,为了提升用户体验, ...

  3. Android中theme.xml与style.xml的区别

    一.相同点 两者的定义相同.继承方式也相同 <?xml version="1.0" encoding="utf-8"?> <resources ...

  4. android 中theme.xml与style.xml的区别

    from://http://liangoogle.iteye.com/blog/1848448 android 中theme.xml与style.xml的区别: 相同点: 两者的定义相同. <r ...

  5. android 可以在程序代码中设置样式:style

    <style name="text_style"> <item name="android:textStyle">bold</it ...

  6. 编译sass,遇到报错error style.scss (Line 3: Invalid GBK character "\xE5")

    今天学习sass,写了一行中文注释,结果却遇到了报错: cmd.exe /D /C call C:/Ruby23-x64/bin/scss.bat --no-cache --update style. ...

  7. 【Android XML】Android XML 转 Java Code 系列之 style(3)

    最近一个月把代码重构了一遍, 感觉舒服多了, 但总体开发进度没有变化.. 今天聊聊把style属性转换成Java代码的办法 先说结论: 引用系统style是无法完美的实现的, 我们如果有写成Java代 ...

  8. Android中的自定义属性的实现

    Android开发中,如果系统提供的View组件不能满足我们的需求,我们就需要自定义自己的View,此时我们会想可不可以为自定义的View定义属性呢?答案是肯定的.我们可以定义自己的属性,然后像系统属 ...

  9. js中对style中的多个属性进行设值

    js中对style中的多个属性进行设值: 看一下案例自然就明白: document.getElementById("my_wz1").style.cssText="bac ...

随机推荐

  1. 开启Qt Lite Project

    发布: http://blog.qt.io/blog/2017/01/23/qt-5-8-released/ 说法一:Qt Lite” is not a tool, but a concept tha ...

  2. 枚举当前系统用户(使用NetUserEnum API枚举)

    using System.Runtime.InteropServices;   [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unico ...

  3. 20 个免费开源的 CSS3 用户界面工具包

    ui.css Metro UI CSS Pure CSS jQuery jKit Solid HTML5/CSS3 UI Kit CSS3 UI Kit Alt CSS3 UI Kit MediaLo ...

  4. KM算法 详解+模板

    先说KM算法求二分图的最佳匹配思想,再详讲KM的实现.[KM算法求二分图的最佳匹配思想] 对于具有二部划分( V1, V2 )的加权完全二分图,其中 V1= { x1, x2, x3, ... , x ...

  5. 使用豆瓣的pip源安装python模块

    1.指定豆瓣pip源安装Django pip install -i https://pypi.doubanio.com/simple/ --trusted-host pypi.doubanio.com ...

  6. 深入理解计算机系统 BombLab 实验报告

    又快有一个月没写博客了,最近在看<深入理解计算机系统>这本书,目前看完了第三章,看完这章,对程序的机器级表示算是有了一个入门,也对 C 语言里函数栈帧有了一个初步的理解. 为了加深对书本内 ...

  7. C++标准库(体系结构与内核分析)(侯捷第一讲)

    一.C++标准库介绍 C++标准库:C++ Standard Library C++标准库与STL有什么关系: STL:Standard Template Library STL包含6大部件,基本占标 ...

  8. 【设计模式】结构型02装饰模式(Decorator Pattern)

    装饰模式(Decorator Pattern) 意图:动态地给一个对象添加一些额外的职责.就增加功能来说,装饰器模式相比生成子类更为灵活. 主要解决:一般的,我们为了扩展一个类经常使用继承方式实现,由 ...

  9. Java学习笔记——设计模式之七.模板方法模式

    模板方法模式(TemplateMethod),定义一个操作中的算法的骨架,而将一些步骤延迟到子类中.模板方法使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤. 结构图: 代码: 算法骨架 ...

  10. Akka-CQRS(14)- Http标准安全解决方案:OAuth2-资源使用授权

    上一篇讨论了SSL/TLS安全连接,主要是一套在通信层面的数据加密解决方案.但我们更需要一套方案来验证客户端.要把不能通过验证的网络请求过滤掉. OAuth2是一套行业标准的网络资源使用授权协议,也就 ...