如何给文本颜色的类文件的TextView [英] how to give textcolor to textview in class file
本文介绍了如何给文本颜色的类文件的TextView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建的TextView我想给黑色文本颜色这个TextView的自定义。如何设置文本颜色。我的code是
I am creating the custom textview i want to give black textcolor to this textview. how can i set textcolor. my code is
TextView的TextView的=新的TextView(本);
TextView textview = new TextView(this);
textview.setText(请遵循此说明);
textview.setText("Please follow this Description");
的setContentView(_textview);
setContentView(_textview);
当我使用textview.setTextColor(的Integer.parseInt(#000000))
when i use textview.setTextColor(Integer.parseInt("#000000"))
在此先感谢
推荐答案
使用Color.parseColor():
Use Color.parseColor():
textview.setTextColor(Color.parseColor("#000000"));
另一种选择是直接使用十六进制整数:
another option is to use HEX integer directly:
textview.setTextColor(0xff000000);
这篇关于如何给文本颜色的类文件的TextView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文