ProgressBar 圆形进度条颜色的设置

来源:互联网 发布:google linux翻墙插件 编辑:程序博客网 时间:2024/06/02 22:39

你是不是还在为设置进度条的颜色而烦恼呢……别着急,且看如下如何解决。

ProgressBar分圆形进度条和水平进度条

我这里就分享下如何设置圆形进度条的颜色吧,希望对大家会有帮助。

源码如下:

布局文件代码:

<ProgressBar   
                android:id="@+id/progressbar"  
                android:layout_width="wrap_content"  
                android:layout_height="wrap_content"  
                android:indeterminateDrawable="@drawable/progressbar"  />  

此XML文件新建在drawable目录下:文件名为:progressbar

 <?xml version="1.0" encoding="utf-8"?>  
<animated-rotate  
   xmlns:android="<a href="http://schemas.android.com/apk/res/android">http://schemas.android.com/apk/res/android</a>"  
 android:pivotX="50%" android:pivotY="50%"      
 android:fromDegrees="0"    
 android:toDegrees="360">  
      
    <shape   
     android:shape="ring"   
     android:innerRadiusRatio="3"    
  android:thicknessRatio="8"   
  android:useLevel="false">    
  <gradient   
   android:type="sweep"   
   android:useLevel="false"    
   android:startColor="#6BD3FF"           
    android:centerColor="#FF7121"    
   android:centerY="0.50"   
   android:endColor="#FFFF00" />    
 </shape>    
      
</animated-rotate>  

ProgressBar 圆形进度条颜色的设置 - Gobby.X - Just Miss.Gobby
原创粉丝点击