布局文件如下
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:indeterminateBehavior="repeat"
android:indeterminateDrawable="@drawable/progress_big" />
</RelativeLayout>
progress_big.xml文件:
<!--多圖層圖片-->
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item >
<rotate android:drawable="@mipmap/spinner_big_inner" android:fromDegrees="1080" android:toDegrees="0"></rotate>
</item>
<item >
<rotate android:drawable="@mipmap/spinner_big_outer" android:fromDegrees="0" android:toDegrees="720"></rotate>
</item>
</layer-list>
上面引用的圖片是這兩張:
layer-list具有圖層疊加的效果,所以只要一張圖片逆時(shí)針旋轉(zhuǎn),一張圖片順時(shí)針旋轉(zhuǎn)即可實(shí)現(xiàn)這種效果: