异常:

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. 学会了使用qmake -query

    D:\Qt\Qt5.6.2_static_kk\bin>qmake -queryQT_SYSROOT:QT_INSTALL_PREFIX:C:/Qt/Qt5.6.2_static_kkQT_IN ...

  2. Model-View-Controller Explained in C++

    The Permanent URL is: Model-View-Controller Explained in C++. The Model-View-Controller (MVC) is not ...

  3. <iOS小技巧>UIview指定设置控件圆角

      一.用法:   众所周知,设置控件的圆角使用layer.cornerRadius属性即可,但是这样设置成的结果是4个边角都是圆角类型.   利用班赛尔曲线画角:   //利用班赛尔曲线画角 UIB ...

  4. GTest翻译词汇表

    版本号:v_0.1 词汇表 Assertion: 断言. Bug: 不翻译. Caveat: 警告. Error bound: 误差范围. Exception: 异常. Flag: 标志位. Floa ...

  5. 3011C语言_基础知识

    第一章  基础知识 1.1  基本框架 //任何一个c语言程序都必须包括以下格式: int main(int argc, char *argv[] ) { : } //这是c语言的基本结构,任何一个程 ...

  6. SpringCloud Sleuth入门介绍

    案例代码:https://github.com/q279583842q/springcloud-e-book 一.Sleuth介绍   为什么要使用微服务跟踪?它解决了什么问题? 1.微服务的现状? ...

  7. ZooKeeper学习之路(一)—— ZooKeeper简介及核心概念

    一.Zookeeper简介 Zookeeper是一个开源的分布式协调服务,目前由Apache进行维护.Zookeeper可以用于实现分布式系统中常见的发布/订阅.负载均衡.命令服务.分布式协调/通知. ...

  8. tar 命令参数解释

    tar 命令 tar [-cxtzjvfpPN]文件与目录参数说明:-c :建立一个打包文件:-x :解开一个打包文件:-t :查看 tar包里面的文件:(特别注意,在选择参数时,c/x/t仅能存在一 ...

  9. 【Linux】一步一步学Linux——虚拟机简介和系统要求(04)

    目录 00. 目录 01. VMware Workstation Pro15介绍 02. Workstation Pro 的主机系统要求 03. 虚拟机网络连接支持 04. 参考 00. 目录 @ 0 ...

  10. [python] 安装TensorFlow问题 解决Cannot uninstall 'wrapt'. It is a distutils installed project

    cmd安装 pip install tensorflow 1.遇到了 ERROR: Cannot uninstall 'wrapt'. It is a distutils installed proj ...