I have got a ListView and I want to change the Backgroundcolor of it. It should go like this. 1.Item = grey; 2. Item; white; 3. Item = grey; 4. Item = white etc. So it shoul
This is another way to change the background using selector switcher. Using this method will preserve the hover and focus colors of the selector.
public View getView(int position, View convertView, ViewGroup parent) {
/* remainder is unchanged */
convertView.setBackgroundResource(position % 2 == 0 ? R.drawable.list_selector_first : R.drawable.list_selector_second);
return convertView;
}