在drawable 文件夹下创建一个xml文件。
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#2C1F6E"
android:dashGap="5dp"
android:dashWidth="5dp"/>
</shape>
然后引用它就ok了。
<!-- 虚线分割 -->
<View
android:layout_marginTop="@dimen/dp_19"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_2"
android:layerType="software"
android:background="@drawable/makehome_line" />