我设法通过创建一个名为的文件来弄清楚如何创建自定义形状(带有虚线)dash.xml里面的/应用程序/res/drawable/ folder:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#534b4b"
android:width="1dp"
android:dashGap="2dp"
android:dashWidth="1dp"
/>
<size
android:height="1dp"
/>
</shape>
现在我对如何将此形状应用于 ListView 感到困惑。我已尝试以下操作,但未显示分隔线:
<ListView android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="@drawable/dash"
android:dividerHeight="1dp"
/>
Wtf?
这是我的,它有效:
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#FF404040"
android:width="1dp"
android:dashGap="3dp"
android:dashWidth="1dp"
/>
<size
android:height="3dp"
/>
</shape>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)