<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="line"> <stroke android:width="1dp" android:color="#aaaaaa" android:dashGap="3dp" android:dashWidth="3dp" /> </shape>然后在控件里面引用这个样式
示例如下
<View android:id="@+id/dotted_line" android:layout_width="match_parent" android:layout_height="5dp" android:background="@drawable/bg_dotted_line" android:layerType="software" />提示:一定要加android:layerType="software" 这一句
新闻热点
疑难解答