Android 如何在表格布局中设置textview的textcolor

Android 如何在表格布局中设置textview的textcolor,android,Android,在表格布局设置textview textcolortextViewOdometerReadingData1中 .setTextColor(颜色为红色) 但它是用灰色显示的。无论我用什么颜色,它都是用灰色显示的。 帮助我,谢谢。我发现您的代码片段 textViewOdometerReadingData1 .setTextColor(color.red); 应该是 textViewOdometerReadingData1 .setTextColor(Color.red); 试试这个: 用于设置文

在表格布局设置textview textcolor
textViewOdometerReadingData1中
.setTextColor(颜色为红色)
但它是用灰色显示的。无论我用什么颜色,它都是用灰色显示的。

帮助我,谢谢。

我发现您的代码片段

textViewOdometerReadingData1 .setTextColor(color.red);
应该是

textViewOdometerReadingData1 .setTextColor(Color.red);
试试这个: 用于设置文本颜色 textViewOdometerReadingData1.setTextColor(Color.Red)

您必须更改:

textViewOdometerReadingData1.setTextColor(Color.red);
你也可以用这个:

textViewOdometerReadingData1 .setTextColor(Color.parseColor("#ff0000"));

不仅C是大写字母,红色也是大写字母

   textViewOdometerReadingData1.setTextColor(Color.RED);

分享更多的代码,因为在普通的文本视图上这对我来说很有用。这里没有什么特别的,以编程方式创建表布局,在一行中添加文本视图,为此我想使用自定义颜色。我正在使用自定义颜色我想这就是问题所在。问问题时,你需要更具体一些。您在哪里指定在问题中使用自定义颜色???人们应该想象您使用的是自定义颜色??我认为Color.red是可以的,因为对于使用此设置背景的我来说,它对我很有用,、textViewOdometerReadingData1.setBackgroundResource(Color.green);