shape画虚线

横着的虚线

    <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>

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容