Android中虚线的写法

如果我们被要求在布局中写入一个虚线,我们可以通过drawable的方法实现这个需求,不用再去求UI作图了。drawable代码如下:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <solid android:color="@android:color/holo_green_light"/>
    <stroke android:width="1dp"
        android:color="@android:color/black"
        android:dashGap="10dp"
        android:dashWidth="20dp"/>
</shape>

猜你喜欢

转载自blog.csdn.net/weixin_38322371/article/details/93747769
今日推荐