当前位置: 移动技术网 > 移动技术>移动开发>Android > Android中自定义水平进度条样式之黑色虚线

Android中自定义水平进度条样式之黑色虚线

2019年07月24日  | 移动技术网移动技术  | 我要评论

以下内容给大家介绍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中自定义水平进度条样式之黑色虚线 的相关知识,希望对大家有所帮助!

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网