自定义ProgressBar

public class MofficeProgressBar extends ProgressBar
{
    public MofficeProgressBar(Context context, AttributeSet attrs) 
    {
        super(context, attrs, android.R.attr.progressBarStyleSmall);
    }
    public void setIndeterminateDrawable(Drawable d)
    {
     super.setIndeterminateDrawable(getResources().getDrawable(R.drawable.progressbar));
     
    }
}

 xml文件:

<rotate xmlns:android="http://schemas.android.com/apk/res/android"  
    android:fromDegrees="0"  
    android:pivotX="50%"  android:duration="100"
    android:pivotY="50%"  
    android:toDegrees="720" >  
    <shape  
        android:innerRadiusRatio="4"  
        android:shape="ring"  
        android:thicknessRatio="9"  
        android:useLevel="false" >  
        <gradient  
            android:centerColor="#FFD2BD"  
            android:centerY="0.50"  
            android:endColor="#FF8A34"  
            android:startColor="#6E9AD7"  
            android:type="sweep"  
            android:useLevel="false" />  
    </shape>  
</rotate>

相关推荐