Android画虚线

	<shape xmlns:android="http://schemas.android.com/apk/res/android"android:shape="line">
	 <!--显示一条虚线,破折线的宽度为dashWith,破折线之间的空隙的宽度为dashGap,当dashGap=0dp时,为实线 -->
	 <stroke
    android:width="1dp"
    android:color="@color/cl_font_gray"
    android:dashGap="3dp"
    android:dashWidth="6dp" />
<!-- 虚线的高度 -->
<size android:height="2dp" />


注意4.0以上使用该shape只会显示直线不会显示虚线,此时需要在使用的时候添加属性android:layerType="software"

</shape>
原文地址:https://www.cnblogs.com/canceler/p/5231548.html