如何以编程方式将文本颜色设置为文本视图
如何以文本方式将文本视图的文本颜色设置为#bdbdbd ? 
使用,..
 Color.parseColor("#bdbdbd"); 
喜欢,
 mTextView.setTextColor(Color.parseColor("#bdbdbd")); 
很好的答案。 添加一个从Android资源XML加载颜色,但仍然以编程方式设置:
 textView.setTextColor(getResources().getColor(R.color.some_color)); 
 请注意,从API 23开始, getResources().getColor()已被弃用。 改用: 
 textView.setTextColor(ContextCompat.getColor(context, R.color.some_color)); 
其中所需的颜色在xml中定义为:
 <resources> <color name="some_color">#bdbdbd</color> </resources> 
更新:
此方法在API级别23中已弃用。请改用getColor(int,Theme)。
检查这个 。
 yourTextView.setTextColor(color); 
 或者,在你的情况下: yourTextView.setTextColor(0xffbdbdbd); 
 TextView tt; int color = Integer.parseInt("bdbdbd", 16)+0xFF000000; tt.setTextColor(color); 
也
 tt.setBackgroundColor(Integer.parseInt("d4d446", 16)+0xFF000000); 
也
 tt.setBackgroundColor(Color.parseColor("#d4d446")); 
看到:
Java / Androidstring到颜色的转换