下面是我的适配器的代码,它允许使用listview的每个项目的第一个字母创建一个弹出窗口,并提供类似于联系人应用程序的内容。
不幸的是,颜色不正确,文字在灰色背景上是黑色的。
我的问题是:
我可以在哪里更改这些颜色?
public class AlphabeticalAdapter extends ArrayAdapter<String> implements
SectionIndexer {
HashMap<String, Integer> alphaIndexer;
String[] sections;
public AlphabeticalAdapter(Context context, String[] items) {
super(context, android.R.layout.simple_list_item_1, items);
alphaIndexer = new HashMap<String, Integer>();
int size = items.length;
for (int x = 0; x < size; x++) {
String s = items[x];
// get the first letter of the store
String ch = s.substring(0, 1);
// convert to uppercase otherwise lowercase a -z will be sorted
// after upper A-Z
ch = ch.toUpperCase();
// HashMap will prevent duplicates
alphaIndexer.put(ch, x);
}
Set<String> sectionLetters = alphaIndexer.keySet();
// create a list from the set to sort
ArrayList<String> sectionList = new ArrayList<String>(sectionLetters);
Collections.sort(sectionList);
sections = new String[sectionList.size()];
sectionList.toArray(sections);
}
public int getPositionForSection(int section) {
return alphaIndexer.get(sections[section]);
}
public int getSectionForPosition(int position) {
return 1;
}
public Object[] getSections() {
return sections;
}
}