小编kav*_*vya的帖子

为textView Android设置文本颜色

在string.xml文件中,我使用以下标记

 <string name="CodeColor" >"#0000ff"</string>
Run Code Online (Sandbox Code Playgroud)

如果我使用

 textview1.setTextColor(Color.RED);
Run Code Online (Sandbox Code Playgroud)

它有效,但是当我使用时

  textview1.setTextColor(TextViewStyles.this.getResources().getColor(R.string.CodeColor)); 

 or
 textview1.setTextColor(R.string.CodeColor);
Run Code Online (Sandbox Code Playgroud)

它不起作用.有什么建议...

提前致谢

android colors textview

9
推荐指数
3
解决办法
8万
查看次数

标签 统计

android ×1

colors ×1

textview ×1