<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/white"/>
<corners android:radius="@dimen/dp_10"></corners>
<stroke
android:width="@dimen/dp_0.6"
android:color="@color/color_gray_cccccc"
android:dashGap="@dimen/dp_2"
android:dashWidth="@dimen/dp_8"
/>
</shape>
layout中
<!--正面-->
<ImageView
android:id="@+id/card_positive"
android:layout_width="@dimen/dp_160"
android:layout_height="@dimen/dp_95"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/dp_13"
android:src="@drawable/bg_txt_stroke_cccccc"/>
备注:
下面对属性进行一下介绍:
width:线段的高度
color:线段的颜色
dashWidth:线段宽度
dashGap:线段之间间隔宽度
然后在布局文件中使用如下:
- 1
- 2
- 3
- 4
- 5
在4.0的设备上,虚线会变成实线,我们需要加入 android:layerType=”software”属性