我正在使用一个简单的适配器来显示我的代码。不幸的是,我需要更改顶部textView的颜色。
这是我的一小段代码:
// Keys used in Hashmap
String[] from = { "txt1", "txt2" };
// Ids of views in listview_layout
int[] ids = { android.R.id.text1, android.R.id.text2 };
SimpleAdapter adapter = new SimpleAdapter(this, aList,
android.R.layout.simple_list_item_2, from, ids);
setListAdapter(adapter);
我尝试制作自己的simple_list_item_2,但无法在xml中更改textView的颜色。您有什么想法吗?
我的最后一个想法是:findViewById(android.R.id.text1).setTextColor(#000),但我不知道将其放在哪里,而且我的十六进制代码不起作用。
setTextColor(Color.parseColor(“#YOURCOLOR”))
。但是,在没有自定义适配器的情况下,这将无法工作。 - FD_