views:

43

answers:

1

How to setup the attribute to achieve the rounded corner for each item in the ListView? Please kindly give an example if you can, thanks!

for example: http://www.flickr.com/photos/jaxxdotorg/3640222441/in/set-72157619952823330/

EDIT: That's my code here for the answer.

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
<gradient
    android:startColor="#ffff"
    android:endColor="#fddd"
    android:angle="270" />
<corners
    android:radius="13dp" />
<stroke
    android:width="1dp"
    android:color="#feee" />
</shape>
+1  A: 

You can achieve this with shapes.

Checkout the Shape Drawable documentation

<?xml version="1.0" encoding="utf-8"?>
<shape
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    <corners
        android:radius="12dp"/>
    <stroke
        android:width="1dp"
        android:color="@color/blue" />
</shape>

The corner element specifies the size of the rounded corner. Now all you need to do is specify this drawable as the background to each list element.

Greg
Thanks it works! I'll put my code into the question.
shiami