1,在自己的项目drawable下面创建shapeb这么一个文件
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <size android:height="4dp"></size> <gradient android:startColor="#ffff0000" android:centerColor="#ff00ff00" android:endColor="#ff0000ff" android:type="linear"></gradient> </shape>
2,在项目的styles.xml文件中引用
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="android:listDivider">@drawable/shapeb</item> </style> </resources>