画一条虚线
2017-12-04 15:20
232 查看
先创建 dashed.xml
再将 dashed.xml 作为 View 的背景
注意:
1. View 的 height 要比虚线的高度大一点,否则显示不出来;
2. Android 4.0以上设备要设置 layerType 属性为 software ,否则显示的效果是一条实线。
<?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="@color/gainsboro" android:dashGap="6dp" android:dashWidth="4dp" /> <size android:height="1dp"/> </shape>
再将 dashed.xml 作为 View 的背景
<View android:layout_width="match_parent" android:layout_height="2dp" android:background="@drawable/dashed" android:layerType="software"/>
注意:
1. View 的 height 要比虚线的高度大一点,否则显示不出来;
2. Android 4.0以上设备要设置 layerType 属性为 software ,否则显示的效果是一条实线。
相关文章推荐
- 画一条虚线
- 画一条虚线的学问
- 在html中打出一条虚线
- iOS笔记之画一条虚线
- 【Android开发笔记】光速码出一条万能虚线
- ps怎么画出一条直的虚线?
- Android画一条虚线
- 在android中画一条虚线
- android画一条虚线
- 在word中,怎么插入一条水平线、粗线、波浪线、双直线、虚线 -------自动边框线
- 如何添加一条虚线
- 论如何画好一条虚线
- android shape的应用之画一条虚线
- div+css中一条直线和一条虚线的实现。
- SVG(可缩放矢量图形)虚线相关属性与线条动画原理:一条会动的线
- flash绘图API:绘制一条虚线
- Android画一条虚线
- 删除有两个字段相同的多条重复记录,只保存一条
- 一条update语句,更新多个列,出现部分成功部分失败的问题
- GridView操作一条记录的N种方式(downmoon原创)