shape画虚线

2019-01-30  本文已影响12人  君莫醉

横着的虚线

    <View
        android:layout_width="match_parent"
        android:layout_height="@dimen/base2dp"
        android:layout_marginLeft="@dimen/base10dp"
        android:layout_marginRight="@dimen/base10dp"
        android:layout_marginTop="@dimen/base5dp"
        android:background="@drawable/bg_shape_xx"
        android:layout_below="@+id/sv_tv_zan"
        android:gravity="center"
        android:layerType="software" />


<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">
    <stroke
        android:width="1dp"
        android:color="@color/sv_color_line1"
        android:dashWidth="2dp"
        android:dashGap="3dp" />
</shape>

竖着的虚线

<?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="1dp"
                    android:color="@color/color_line1"
                    android:dashGap="2dp"
                    android:dashWidth="6dp"/>
            </shape>
        </rotate>
    </item>
</layer-list>

上一篇 下一篇

猜你喜欢

热点阅读