In my application I have a requirement of listview with empty spaces between rows of list.So that I can give background to each row and it will look something like blocks of row
I had the same problem except I needed to set the divider programatically because the view was dynamically generated. I'm posting this answer because it was my first google hit for future reference.
You need a custom Drawable.
Create a new file with the following code:
drawable/list_divider.xml
Inside your java code you need to get a reference to your ListView and set the divider like this:
listView.setDivider(getResources().getDrawable(R.drawable.list_divider));
The result is exactly the same.