In reference to these questions :
Adding gradient effect to TextView in a ListView generates NPE
and
How to change color and font on ListView
<
Referred from here : How do I create a ListView with rounded corners in Android? (I have found it very useful.)
Add the following into a file (say gradient.xml) and then place it in (res/drawable/gradient.xml) directory.
Once you are done with creating this file,just set the background in one of the following ways:
Through Code: listView.setBackgroundResource(R.drawable.customshape);
Through XML,just add the following attribute to the container (ex: LinearLayout or to any fields):
android:background="@drawable/customshape"