Android practice – ListView With Round Corner
1, Use the shape tag to create a drawable[listview_roundcorner_item.xml] with rounded corners. Like ,
</pre> <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:angle="270" android:endColor="#E77A26" android:startColor="#E77A26" /> <corners android:bottomLeftRadius="8dp" android:bottomRightRadius="8dp" android:topLeftRadius="8dp" android:topRightRadius="8dp" /> </shape> <pre>
2, There are two ways to implement it .
- Add attribute to ListView
android:background="@drawable/listview_roundcorner_item"
- Set background by sourcecode
listView.setBackgroundResource(R.drawable.listview_roundcorner_item);
3, Finally , if you run this example you would get the following effect.

Categories: Android

Clean and simple example..
Already new this, but found your blog by “accident”..
Nice to see that this can be written down in a simple way. Too many complicated explanations out there..
Thumbs up!
Big Thanks to you.