//竖线
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-300dp"
android:right="-300dp">
<rotate
android:fromDegrees="90"
android:visible="true">
<shape android:shape="line">
<stroke
android:width="@dimen/x2"
android:color="@color/color_1092ab"
android:dashGap="@dimen/x3"
android:dashWidth="@dimen/x3"/>
</shape>
</rotate>
</item>
</layer-list>
//横线
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:left="-300dp"
android:right="-300dp">
<rotate
android:visible="true">
<shape android:shape="line">
<stroke
android:width="@dimen/x2"
android:color="@color/color_1092ab"
android:dashGap="@dimen/x3"
android:dashWidth="@dimen/x3"/>
</shape>
</rotate>
</item>
</layer-list>
1.从android3.0開始,安卓关闭了硬件加速功能。所以就不能显示了,所以就是在 AndroidManifest.xml。或者是在activity中把硬件加速的功能关掉就能够了android:hardwareAccelerated="false"或者是view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);