Related to this post on stackoverflow.com: https://stackoverflow.com/a/51794993/5318303
See FramesRotatorView.java file.
Don't forget to insert these lines in res/values/attrs.xml
file:
<resources>
<!-- ... -->
<declare-styleable name="FramesRotatorView">
<attr name="framesCount" format="integer"/>
<attr name="duration" format="integer" />
</declare-styleable>
<!-- ... -->
</resources>
Sample usage (like ImageView
but android:src
or app:srcCompat
drawable will rotating):
<ir.openside.frameanimatorsample.FramesRotatorView
android:src="@drawable/ic_spinner"
app:framesCount="12"
app:duration="1200"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
Demo Video (with different sizes):