android在style中使用自定义属性 error: style attribute not found.
异常:
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.的更多相关文章
- 【转】 Android xml中 @和?区别,style和attr小结
引用资源时,使用@还是?的区别,例如在设置style的时候既可以使用@也可以使用? style="?android:attr/progressBarStyleHorizontal" ...
- Android应用开发中的风格和主题(style,themes)
http://www.cnblogs.com/playing/archive/2011/04/01/2002469.html 越来越多互联网企业都在Android平台上部署其客户端,为了提升用户体验, ...
- Android中theme.xml与style.xml的区别
一.相同点 两者的定义相同.继承方式也相同 <?xml version="1.0" encoding="utf-8"?> <resources ...
- android 中theme.xml与style.xml的区别
from://http://liangoogle.iteye.com/blog/1848448 android 中theme.xml与style.xml的区别: 相同点: 两者的定义相同. <r ...
- android 可以在程序代码中设置样式:style
<style name="text_style"> <item name="android:textStyle">bold</it ...
- 编译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. ...
- 【Android XML】Android XML 转 Java Code 系列之 style(3)
最近一个月把代码重构了一遍, 感觉舒服多了, 但总体开发进度没有变化.. 今天聊聊把style属性转换成Java代码的办法 先说结论: 引用系统style是无法完美的实现的, 我们如果有写成Java代 ...
- Android中的自定义属性的实现
Android开发中,如果系统提供的View组件不能满足我们的需求,我们就需要自定义自己的View,此时我们会想可不可以为自定义的View定义属性呢?答案是肯定的.我们可以定义自己的属性,然后像系统属 ...
- js中对style中的多个属性进行设值
js中对style中的多个属性进行设值: 看一下案例自然就明白: document.getElementById("my_wz1").style.cssText="bac ...
随机推荐
- .NET重思(一)sealed和interface
博主这几天正好闲着,砸砸基础,毕竟自学,基础不牢靠很致命,要踏实啊~~~ 1.sealed关键字修饰一个类,也可以修饰实现方法或者属性.当sealed用于修饰一个类时,这个类不可以被继承,因此,这个类 ...
- Delphi事件的广播
原文地址:Delphi事件的广播 转作者:MondaySoftware 明天就是五一节了,辛苦了好几个月,借此机会应该尽情放松一番.可是想到Blog好久没有写文章,似乎缺些什么似的.这几个月来在项目中 ...
- 21 步助你成为成功的 Web 开发者(激情不是被动的:它是一种对行动起来的追求)
随着 Web 开发产业的爆发式发展,许多人会问这样的问题:我如何才能成为一名 Web 开发者?我认为这是一个错误的提问.问题应该是:我如何才能成为一名成功的 Web 开发者? 能提出这样的问题很重要, ...
- Qt:移动无边框窗体(使用Windows的SendMessage)
移动无边框窗体的代码网上很多,其原理都是一样的,但是是有问题的,我这里只是对其修正一下 网上的代码仅仅实现了两个事件 void EditDialog::mousePressEvent(QMouseEv ...
- 什么是Android NDK
1.NDK是一系列工具的集合. NDK提供了一系列的工具,帮助开发者快速开发C(或C++)的动态库,并能自动将so和java应用一起打包成apk.这些工具对开发者的帮助是巨大的. NDK集成了交叉编译 ...
- Delphi XE6 如何设计并使用FireMonkeyStyle
介绍 FireMonkey使用Style来控制控件的显示方式. 每个控件都有一个StyleLookup属性,FireMonkey就是通过控件的这个属性来在当前窗体的StyleBook控件中查找匹配 ...
- Ruby元编程:执行某个目录下的全部测试用例
目前手里有个测试项目各个feature的测试用例都放在对应的子目录下,虽然有自动化测试框架的帮助执行起来很方便,但是偶尔也有需要在本地执行某个feature的全部测试用例集合.因为本人对shell脚本 ...
- Hadoop集群(第3期)机器信息分布表
1.分布式环境搭建 采用4台安装Linux环境的机器来构建一个小规模的分布式集群. 图1 集群的架构 其中有一台机器是Master节点,即名称节点,另外三台是Slaver节点,即数据节点.这四台机器彼 ...
- Android开发之旅(1) 之 Android 开发环境搭建
工作室原创出品,欢迎转载,欢迎交流. 转载请注明原文:http://www.cnblogs.com/wangleiblog/p/6019063.html Android开发之旅目录 1 前言 很多朋友 ...
- 大白话5分钟带你走进人工智能-第30节集成学习之Boosting方式和Adaboost
目录 1.前述: 2.Bosting方式介绍: 3.Adaboost例子: 4.adaboost整体流程: 5.待解决问题: 6.解决第一个问题:如何获得不同的g(x): 6.1 我们看下权重与函数的 ...