效果如图所示,用一个图片替换到了android自带的圆形样式。创建一个动画就可以实现,最简单。
①在drawable文件夹下创建一个rotate类型的xml,mystyle.xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading_1"
android:pivotX="50%"
android:pivotY="50%" >
</rotate>
② 在ProgressBar中使用属性 android:indeterminateDrawable="@drawable/mystyle" 就可以
<ProgressBar
android:id="@+id/progress"
android:layout_width="60dp"
android:indeterminateDrawable="@drawable/mystyle"
android:layout_height="100dp"
android:layout_centerInParent="true" />
最后上图我使用ProgressBar的原图片