My ListView
contains two Textviews
. In one row first one is for name and second one is for result. I need to change the background color of the re
I think it is because list view recycles the view hence causing such problems .Try the following :
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = null;
convertView = null;
row = convertView;
if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) _context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row, parent,
false);
// your code
}
return row;
}
Since convert view and row view both are intialized as null .Hence rows will be inflated every time and preventing recycling of views .
Link: Listview android recycling This links explains the mechanism of recycling views.
android:cacheColorHint="#00000000"