1.在anim文件夹下创建旋转动画xml
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/loading"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%">
</rotate>
2.在style.xml文件夹下创建新的style
<style name="progressbar">
<item name="android:indeterminateDrawable">@drawable/progress</item>
<item name="android:minWidth">80dp</item>
<item name="android:maxWidth">80dp</item>
<item name="android:minHeight">80dp</item>
<item name="android:maxHeight">80dp</item>
</style>
3.布局文件中引用创建的style给progressbar
<ProgressBar
style="@style/progressbar"
android:indeterminateDuration="1000"
android:layout_width="200dp"
android:layout_height="200dp" />