首页 > 代码库 > Android设置ListView分隔线边距

Android设置ListView分隔线边距

Use ‘inset‘.....

(list_divider.xml)

<?xml version="1.0" encoding="UTF-8"?><inset xmlns:android="http://schemas.android.com/apk/res/android"    android:insetLeft="50dp"    android:insetRight="50dp" > <shape>    <solid android:color="@color/orange" />    <corners android:radius="2.0dip" /></shape></inset>

and in your list view add like this...

<ListView    android:dividerHeight="2dp"    android:divider="@drawable/list_divider"    .../>

you can set the inset value as desired...

 

via: http://stackoverflow.com/questions/14054364/how-to-assign-padding-to-listview-item-divider-line