Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 改变孩子';s可扩展列表的文本颜色_Android_Eclipse_Colors - Fatal编程技术网

Android 改变孩子';s可扩展列表的文本颜色

Android 改变孩子';s可扩展列表的文本颜色,android,eclipse,colors,Android,Eclipse,Colors,我已经回顾了以前的问题,并尝试了提供的所有解决方案,但似乎没有任何效果,我有一个可扩展的列表,我想将子元素的文本颜色设置为白色(非透明,纯白色),这是我的代码: public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { TextView textView

我已经回顾了以前的问题,并尝试了提供的所有解决方案,但似乎没有任何效果,我有一个可扩展的列表,我想将子元素的文本颜色设置为白色(非透明,纯白色),这是我的代码:

public View getChildView(int groupPosition, int childPosition,
                         boolean isLastChild, View convertView, ViewGroup parent) {
    TextView textView = getGenericView();
    textView.setText(getChild(groupPosition, childPosition).toString());
    textView.setTextColor(color.white);
    return textView;
}
我还尝试:
textView.setTextColor(getResources().getColor(R.color.white))

但是当我运行应用程序时,文本永远不会显示(我不确定它是否使其透明)


我该怎么办?

如果您担心它是透明的,请传递一个对应于不透明白色的
<0xffffff
十六进制值,而不是
颜色。白色
您可以使用十六进制值

textView.setTextColor(Color.parseColor("#FFFFFF"));
我使用了parseColor方法,该方法将十六进制转换为有效的颜色

颜色是一个类。使用

textView.setTextColor(Color.white);
而不是

textView.setTextColor(color.white);

欢迎来到SO!这将有助于您发布链接到您在文章中提到的解决方案。