android客户端学习-画虚线

来源:互联网 发布:stc89c52单片机原理图 编辑:程序博客网 时间:2024/06/11 20:47

在drawable文件夹下创建dash_line.xml文件

代码如下:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line" > 
    <stroke 
        android:dashGap="5dp" 
        android:dashWidth="4dp" 
        android:width="1dp" 
        android:color="#CCCCCC"
        /> 
    <!-- 虚线的高度 --> 
    <size android:height="0.5dp" /> 

</shape>

 

在页面的xml文件中调用如下:

 <TextView
                android:layout_width="match_parent"
                android:layout_height="2dp"
                android:background="@drawable/dash_line"
                android:layerType="software"
                ></TextView>

 

 

0 0
原创粉丝点击