drawable下新建一个虚线的xml。dash_line.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line" > <!-- 显示一条虚线,破折线的宽度为dashWith,破折线之间的空隙的宽度为dashGap。当dashGap=0dp时。为实线 --> <stroke android:dashGap="2dp" android:dashWidth="2dp" android:color="#000" /> <!-- 虚线的高度 --> <size android:height="1dp" /> </shape>
然后再布局引用就ok了。