Why set setBackgroundColor is not working in my custom listView

You could also use setBackgroundColor() but you'll need to understand that is expects an object not a resource id. So you'd have to convert the resource to a color object, like so:

setBackgroundColor(getResources().getColor(R.color.rojo));

To set color by setBackgroundColor method do this:-

setBackgroundColor(Color.parseColor("#e7eecc"));

either by

setBackgroundResource(R.color.<Your-Color>)

.setBackgroundColor(getResources().getColor(R.color.raj));

Use

setBackgroundResource(R.color.rojo);

R.color.rojo is a resource, it is not color..