我有一个奇怪的问题。我设置列表视图的项目的背景色如下:在ListView中回收的背景颜色
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
...
if (status == true) {
row.setBackgroundColor(Color.argb(255,0,85,187));
}
else {
if (morestuff) {
row.setBackgroundColor(Color.argb(128,255,0,0));
}
}
...
}
这似乎工作。但是,当我滚动列表视图,然后回来,一些行已获取另一行的颜色,而不是由此代码设置。我怀疑listview是作为一个优化回收视图。
我该如何解决这个问题?