我在Activity类中使用了ListView。我没有为ListView使用任何XML代码。现在我无法更改listView中文本项目的颜色。如何更改列表视图中列表项的颜色
我改变了ListView的背景颜色,但无法改变列表项的颜色。我从互联网上获得了一些链接,但无法弄清楚。任何人都可以帮助我用一些代码做到这一点?
我Activity类看起来是这样的:
ListView listView;
// Create an array of Strings, that will be put to our ListActivity
String[] names = new String[] { "India", "Malaysia" };
TextView tv = new TextView(getApplicationContext());
tv.setText("Select Country");
tv.setTextColor(012);
listView = getListView();
listView.addHeaderView(tv);
listView.setCacheColorHint(Color.rgb(36, 33, 32));
listView.setBackgroundColor(Color.rgb(225, 243, 253));
this.setListAdapter(new ArrayAdapter<String>(this,android.R.layout.simple_expandable_list_item_1,names));
}
以上,tv.setTextColor
设置列表项的标题。它不是因为它要求我传递一个整数值。我可以传递什么样的整数值用于颜色? 任何人都可以建议更改列表项的颜色的代码?