这里有新鲜出炉的精品教程,程序狗速度看过来!
Android是一种基于Linux的自由及开放源代码的操作系统,主要使用于移动设备,如智能手机和平板电脑,由Google公司和开放手机联盟领导及开发。尚未有统一中文名称,中国大陆地区较多人使用“安卓”或“安致”。
这篇文章主要介绍了Android中自定义水平进度条样式之黑色虚线 的相关资料,需要的朋友可以参考下
以下内容给大家介绍Android中自定义水平进度条样式之黑色虚线,对代码实现方法感兴趣的朋友一起学习吧。
布局layout中使用:
- <ProgressBar
- android:id="@+id/progress_bar"
- style="?android:attr/progressBarStyleHorizontal" <!--必须设置为水平-->
- android:progressDrawable="@drawable/myprogress" <!--此处用自定义样式-->
- android:layout_width="dp"
- android:layout_height="dp"
- android:layout_marginTop="dp"
- android:maxHeight="dp"
- android:minHeight="dp"
- android:max=""
- android:secondaryProgress=""
- android:progress=""
- android:indeterminateOnly="false" />
下面为xml源代码myprogress.xml:
- <?xml version="." encoding="utf-" ?>
- <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
- <!--item background与progress 顺序不可颠倒 -->
- <item android:id="@android:id/background">
- <shape android:shape="line">
- <stroke android:width="dp" android:color="#" <!--背景颜色和宽度-->
- android:dashWidth="dp" android:dashGap="dp" />
- <!--虚线间隔dp-->
- </shape>
- </item>
- <item android:id="@android:id/progress">
- <clip>
- <shape android:shape="line">
- <stroke android:width="dp" android:color="#" android:dashWidth="dp" android:dashGap="dp"
- />
- </shape>
- </clip>
- </item>
- </layer-list>
以上所述是本文给大家分享的Android中自定义水平进度条样式之黑色虚线 的相关知识,希望对大家有所帮助!
来源: http://www.phperz.com/article/17/0915/348841.html