您的位置:首页 > 移动开发 > Android开发

在android中画一条虚线

2018-01-06 00:00 253 查看
摘要: 总结是使知识变成自己的唯一途径.除了你是创造者

1.在drawable 中创建一个文件 ;

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:width="1dp"
android:color="#4cffffff"
android:dashGap="5dp"
android:dashWidth="5dp" />
</shape>

2.在xml中使用

<View
android:id="@+id/dotted_line"
android:layout_width="match_parent"
android:layout_height="5dp"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:background="@drawable/bg_dotted_line"
android:layerType="software"
/>

注意一定要添加layerType
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: