As the views are recycled by the adapter, you probably keep an old state from a previous display of that view.
Check how you bind the data to your custom view, by having in mind that all previously bound data can be kept if they're not reset.
For instance the following data bind method in a custom view can lead to the same problem :
public void bind(Data data) {
if (data.foo) {
textView.setColor(Color.WHITE);
}
(...)
}
If the view is recycled and previously data.foo
was true, if now data.foo
is false, the textView will keep its color to white. The correct way is so :
public void bind(Data data) {
if (data.foo) {
textView.setColor(Color.WHITE);
} else {
textView.setColor(<inital color>);
}
(...)
}