自定义ListView圆角

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));

<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:
<?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>


进阶:利用9-Patch PNG来实现ListView的圆角显示
http://www.learningandroid.net/blog/advance/9-patch-listview-coner/

Android ListView圆角实现
http://topmanopensource.iteye.com/blog/1595232

你可能感兴趣的:(java,xml,android)