system default Style progress bar
/** * Android Seven progress bar style * http://www.jb51.net/article/71269.htm seven different styles * http://www.cnblogs.com/Yang-jing/p/3757219.html */
Customizing styles based on the system progress bar
/** * progress bar based on system custom style * http://www.jb51.net/article/91909.htm percent style * http://www.jb51.net/article/96146.htm Span style= "COLOR: #008000" > load style */
<ProgressBar android:id= "@+id/pb_progressbar" style= "@style/styleprogressbarmini" android:layout_width= "Match_parent" android:layout_height= "Wrap_content" Android:layout_margin= "30DP" android:background= "@drawable/shape_progressbar_bg" Android:max= " android:progress" = "/>"
Values/styles.xml
<style name= "Styleprogressbarmini" parent= "@android: Style/widget.progressbar.horizontal" > <item Name = "Android:maxheight" >50dip</item> <item name= "Android:minheight" >10dip</item> < Item Name= "Android:indeterminateonly" >false</item> <item name= "Android: Indeterminatedrawable "> @android:d rawable/progress_indeterminate_horizontal </ item> <item name= "android:progressdrawable" > @drawable/shape_progressbar_mini</item> </style>
View Code
Drawable/shape_progressbar_bg.xml
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" android:shape= "Rectangle" > <solid android:color= "#cecece"/> <corners android: radius= "90DP"/> <padding android:bottom= "1DP" android:left= "1DP" Android:right= "1DP" android:top= "1DP"/></shape>
View Code
Drawable/shape_progressbar_mini.xml
<?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android "> <item android:id=" @android: Id/background "> <shape> <corners Android:radiu s= "5dip"/> <Gradient Android:angle= "270"Android:centery= "0.75"Android:endcolor= "#FFFFFF"Android:startcolor= "#FFFFFF"/> </shape> </item> <item android:id= "@android: Id/secondaryprogress" > <clip> <shape> <corners android:radius= "0dip"/> <Gradient Android:angle= "270"Android:centery= "0.75"Android:endcolor= "#df0024"Android:startcolor= "#df0024"/> </shape> </clip> </item> <item android:id= "@android: id/progr ESS "> <clip> <shape> <corners android:radius=" 5dip "/> <Gradient Android:angle= "270"Android:centery= "0.75"Android:endcolor= "#0c07ff"Android:startcolor= "#33fd00"/> </shape> </clip> </item></layer-list>
View Code
Percent progress bar
/** * Custom progress bar Style Example 3 * Reference item: * Https://github.com/hongyangAndroid/Android-ProgressBarWidthNumber */
ProgressBar of the Android UI series