转载请注明出处: http://blog.csdn.net/fth826595345/article/details/9208771 

TextView tText=(TextView) findViewById(R.id.textv_name);
//第1种:
tText.setTextColor(android.graphics.Color.RED);//系统自带的颜色类 // 第2种:
tText.setTextColor(0xffff00ff);//0xffff00ff是int类型的数据,分组一下0x|ff|ff00ff。0x是代表颜色整数的标记,ff是表示透明度,ff00ff表示颜色,注意:这里ffff00ff必须是8个的颜色表示,不接受ff00ff这样的6个的颜色表示。 //第3种:
tText.setTextColor(android.graphics.Color.parseColor("#87CEFA")) ; //还是利用Color类; //第4种:
tText.setTextColor(this.getResources().getColor(R.color.red)); /*通过获得资源文件进行设置。 依据不同的情况R.color.red也能够是R.string.red或者R.drawable.red。
* 当然前提是须要在对应的配置文件中做对应的配置。如(xml 标签):
*
* <color name="red">#FF0000</color>
<drawable name="red">#FF0000</drawable>
<string name="red">#FF0000</string>*/

最新文章

  1. Git初使用
  2. Golang 绘图基础- 不同的输出源
  3. 2016年辛星less教程发布了
  4. 【HDOJ】4544 湫湫系列故事——消灭兔子
  5. ubuntu 右键新建文档
  6. 如何优化cocos2d/x内存使用和程序大小的程序
  7. Canvas:时钟
  8. 移植 iperf 网络性能测试工具到 Android-P
  9. anaconda虚拟环境管理,从此Python版本不用愁
  10. 通过PropertyDescriptor反映射调用set和get方法
  11. Ubuntu14.04 + Text-Detection-with-FRCN(CPU)
  12. 利用JavaMail发送邮件:smtp.163.com
  13. J1850 Implement
  14. 获取Java正在执行的方法
  15. python中的logger模块详细讲解
  16. laravel 的passport Oauth 认证登录请求 的 oauth_token 重置
  17. day18-事务与连接池 1.复习
  18. I would I were a careless child
  19. [Django笔记] Apache + mod-wsgi 环境部署所遇到的各种问题总结
  20. 洛谷P2534 [AHOI2012]铁盘整理

热门文章

  1. 如何使用jpegtran 压缩JPG图片
  2. ecshop 2.7.x 批量测试
  3. windows下安装Apache
  4. sh-copy-id命令报错:-bash: ssh-copy-id: command not found
  5. 推荐一些socket工具,TCP、UDP调试、抓包工具 (转载)
  6. 发布构件到Maven中央仓库
  7. Java基础88 数据库设计的三大范式
  8. YOLOv2训练自己的数据集(VOC格式)
  9. MySQL多线程备份工具mydumper
  10. ajax最基础入门