自定义颜色的setTextColor问题
来源:互联网 发布:童装行业数据 编辑:程序博客网 时间:2024/05/16 01:26
在values\colors.xml中自定义颜色:
<resources>
<color name="color_black">#000000</color>
</resources>
在使用时,用setTextColor引用时,很容易就会犯如下错误:
my.setTextColor(R.color.color_black);
这样的写法,其实是设置了R.color.color_black在R.java中的对应的id值(这个id值是自动生成的),而不是这个id对应的颜色值。
正确的用法如下格式:
myview.setTextColor(context.getResources().getColor(R.color.color_black));
- 自定义颜色的setTextColor问题
- Android SetTextColor的问题
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- android setTextColor 无效的问题
- 关于TextView.setTextColor(int); 括号里那个颜色int值的问题
- 关于TextView.setTextColor(int); 括号里那个颜色int值的问题
- android.textiview.settextcolor失效的问题
- Android中设置TextView的颜色setTextColor失败,变成灰色
- 【android】代码设置text的颜色setTextColor用法
- Android中TextView中的文字颜色设置setTextColor的用法
- android 代码设置颜色setTextColor
- linux后台开发常用调试工具
- 正则表达式学习笔记
- careercup4.3
- 汇编jmp指令
- 线性表之链式存储结构
- 自定义颜色的setTextColor问题
- 测试你的浏览器对html5的支持
- C# to POST HTTP with XML
- 学习低层的好网址
- 解决问题 :OGRE EXCEPTION(0:IOException): Cannot create settings file
- javaScript RegExp对象问题
- windows如何不用外界软件进行窗口截屏?
- C#向服务器发送XML数据
- 商界传奇Bill Gross:我从创办的100多家公司中学到了什么