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 ...
随机推荐
- UI设计师必收!同行总结可即刻上手的iOS规范参考
分享 <关于我> 分享 [中文纪录片]互联网时代 http://pan.baidu.com/s/1qWkJfcS 分享 <HTML开发MacOSAp ...
- Building PySide on Microsoft Windows
Prerequisites MS Visual Studio Express 2008 [microsoft.com] NOTE: Visual Studio Express 2010 is not ...
- 信鸽推送在springboot中出现jar包冲突问题
错误提示 : java.lang.NoSuchMethodError: org.json.JSONObject.put(Ljava/lang/String;Ljava/util/Collection; ...
- 【jar包管理】Maven BOM
BOM Alibaba Spring Boot Dependencies is a Maven BOM used to manage the versions of most used Alibaba ...
- 【IDE】idea在debug模式启动非常慢,debug模式一直在启动中状态
现象:一直处于启动中状态,日志刷的很慢,非debug模式正常启动: 最终解决方式:下图按钮,取消所有打过的断点,问题解决
- 使用redis PSUBSCRIBE实现实时任务
PSUBSCRIBE可以监听键的过期事件 1.进行数据库的配置 notify-keyspace-events Ex 2.使用命令监听事件 psubscribe __keyevnet@0__:expi ...
- composer简述
1.composer是一个php依赖管理工具,而不是一个包管理器.怎么来理解呢?就像在是在电脑中安装了个电脑管家,在电脑管家的软件管理中下载和更新软件,其实这个电脑管家只是一个管理工具,而真正的软件可 ...
- appcan中evaluateScript、evaluatePopoverScript的使用
1. 如果要在某个主窗体中执行JS,使用 appcan.window.evaluateScript(name,scriptContent) eg: appcan.window.evaluateScri ...
- Linux/windows com串口 java 接收数据 并解析 web程序
1.首先应公司要求再 com 口本来使用 .net 由于 .net 适用 linux 太麻烦 改为java 准备工作 准备 RXTXconmm.jar(版本很重要) 因为版本问题我搞了一天. 主要讲述 ...
- Linux下编译PHP常见错误及解决方法
1.configure: error: xml2-config not found. Please check your libxml2 installation.yum install libxml ...