自定义ListView圆角

size=large]Java代码 
String[] mStrings = { "aaaa", "bbbb", "cccc" };  
ListView listView = (ListView) findViewById(R.id.list);  
        listView.setAdapter(new ArrayAdapter<String>(this,  
                android.R.layout.simple_list_item_1, mStrings)); 

String[] mStrings = { "aaaa", "bbbb", "cccc" };
ListView listView = (ListView) findViewById(R.id.list);
listView.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, mStrings));


Java代码 
<ListView android:id="@+id/list" android:layout_width="fill_parent" 
        android:layout_height="wrap_content" android:background="@layout/list_corner_1" 
        android:layout_weight="1.0" /> 

<ListView android:id="@+id/list" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="@layout/list_corner_1"
android:layout_weight="1.0" />


list_corner_1.xml:
Java代码 
<?xml version="1.0" encoding="UTF-8"?>  
<shape xmlns:android="http://schemas.android.com/apk/res/android" 
    android:shape="rectangle">  
    <gradient android:startColor="#CCCCFF" android:endColor="#99CCFF" 
        android:angle="90" />  
    <corners android:bottomRightRadius="10dp" 
        android:bottomLeftRadius="10dp" android:topLeftRadius="10dp" 
        android:topRightRadius="10dp" />  
</shape>  [/size]

你可能感兴趣的:(ListView)