首页 > 学院 > 开发设计 > 正文

虚线效果

2019-11-06 09:37:06
字体:
来源:转载
供稿:网友

通过repeat把一个图片重复拼接在一起成一条虚线

虚线资源文件repeat_bmp_h.xml

<?xml version="1.0" encoding="utf-8"?><bitmap xmlns:android="http://schemas.android.com/apk/res/android"    android:src="@drawable/repeat_h"    android:tileMode="repeat" ></bitmap>其中repeat_h是虚线其中的一小段图片,左右透明。

程序中使用,只需要把repeat_bmp_h.xml设置为背景图片即可:

<View         android:id="@+id/v_curtaskitem_line"        android:layout_width="188dp"        android:layout_height="2dp"        android:layout_below="@id/tv_curtaskitem_time"        android:layout_marginTop="20dp"        android:layout_alignLeft="@id/tv_curtaskitem_time"        android:background="@drawable/repeat_bmp_h"/>另,竖线的话,则把图片旋转90度即可得到竖的虚线


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表