1.虚线
<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>
2.虚线和实线并存
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape>
<stroke
android:width="1dp"
android:color="#E8A227" />
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
</shape>
</item>
<item
android:bottom="1dp"
android:left="1dp"
android:right="1dp"
android:top="1dp">
<shape>
<stroke
android:dashGap="15dp"
android:dashWidth="15dp"
android:width="2.5dp"
android:color="#E8A227" />
<solid android:color="#FFFFFF" />
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
1.从android3.0开始,安卓关闭了硬件加速功能,所以就不能显示了,所以就是在 AndroidManifest.xml,或者是在activity中把硬件加速的功能关掉就可以了android:hardwareAccelerated="false"或者是view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);