码迷,mamicode.com
首页 > 其他好文 > 详细

自定义水平进度条样式:黑色虚线

时间:2014-07-22 22:45:34      阅读:180      评论:0      收藏:0      [点我收藏+]

标签:android   style   blog   http   color   使用   

布局layout中使用:

 1 <ProgressBar
 2         android:id="@+id/progress_bar"
 3         style="?android:attr/progressBarStyleHorizontal"         <!--必须设置为水平-->
 4         android:progressDrawable="@drawable/myprogress"          <!--此处用自定义样式-->
 5         android:layout_width="158dp"
 6         android:layout_height="5dp"
 7         android:layout_marginTop="5dp"
 8         android:maxHeight="5dp"
 9         android:minHeight="5dp"
10         android:max="100"
11         android:secondaryProgress="0"
12         android:progress="0"
13         android:indeterminateOnly="false" />

下面为xml源代码myprogress.xml:

 

 1 <?xml version="1.0" encoding="utf-8"?>
 2 <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
 3     <!--item background与progress 顺序不可颠倒 -->
 4     <item android:id="@android:id/background" >
 5         <shape android:shape="line">
 6             <stroke
 7                 android:width="4dp" android:color="#666666"          <!--背景颜色和宽度-->
 8                 android:dashWidth="4dp" android:dashGap="1dp" />     <!--虚线间隔1dp-->
 9         </shape>   
10     </item>
11     <item android:id="@android:id/progress" >
12         <clip>
13             <shape android:shape="line">
14                 <stroke
15                     android:width="4dp" android:color="#000000"    
16                     android:dashWidth="4dp" android:dashGap="1dp" />   
17             </shape>
18         </clip>
19     </item>
20 </layer-list>

自定义水平进度条样式:黑色虚线,布布扣,bubuko.com

自定义水平进度条样式:黑色虚线

标签:android   style   blog   http   color   使用   

原文地址:http://www.cnblogs.com/wenjerry/p/3859867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!