I am trying to programmatically set a custom background color in my ListView Adapter but I want to keep the default Listview Selector style from Android.
I am settin
Try write your custom adapter and set rowView BackgroundColor like that(if position odd number BLACK, even RED). also you can send a color list to adapter and set different color for every rowView
public View getView(int position, View convertView, ViewGroup parent) {
View rowView = convertView;
enter code here
if(rowView == null)
{
if((position % 2)==1){
rowView.setBackgroundColor(Color.BLACK)
//colorList :setBackgroundColor( colorList.get(position) )
}
else{
rowView.setBackgroundColor(Color.RED)
}
}
return rowView;
}