Android遇到setTextColor无效的解决办法
来源:互联网 发布:个人发卡平台源码 编辑:程序博客网 时间:2024/05/21 07:52
设置颜色无效有两种场景:
mTv.setTextColor( mContext.getResources().getColor(R.color.text_color));
(注意color.xml文件中的 颜色值是以#号开头的rgb值,可以无透明值)
二:当颜色值在代码中:
这种情况颜色值是以0xff3b9bff的形式存在(注意Android的要以8位存在才能生效,ios是6位),代码如下:
mTv.setTextColor(0xff3b9bff);
重点来了,遇到兼容问题怎么办?
解决办法如下:
int titleTvColor = 0x99000000;
try {
titleTvColor = Integer.parseInt(item.color.replace("0x", ""), 16) + 0xff000000;
} catch (NumberFormatException e) {
e.printStackTrace();
}
mTv.setTextColor(titleTvColor);
屈服于ios,只能自己补位了。
0 0
- Android遇到setTextColor无效的解决办法
- Android setTextColor无效解决办法
- android setTextColor 无效的问题
- android checkBox setTextColor无效
- Android SetTextColor的问题
- Android marginright 无效的解决办法
- Android layout_margin 无效的解决办法
- 纯代码setTextColor无效
- TextView代码setTextColor无效
- android setTextColor
- setTextColor Android
- android setTextColor()的参数设置不起作用的解决方法
- VS编译遇到errorD8021无效的数值参数解决办法
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android中设置TextView的颜色setTextColor
- Android 中点击两次返回键才退出
- 使用Amoeba实现MySQL的主从读写分离
- Atitti.数字证书体系cer pfx attilax总结
- C++函数重载
- hdu 1533 最小费用最大流模板题
- Android遇到setTextColor无效的解决办法
- 有关红帽虚拟机的安装
- hdu5025 Saving Tang Monk BFS
- 真实案例出发,再谈retrofit封装
- Struts2实现文件上传和下载
- Atitit.rsa密钥生成器的attilax总结
- Leetcode(310) Minimum Height Trees
- c++ string头文件
- Struts2学习之Struts2中的拦截器