Skip to content

Android: A view that rotates discretely (between some number of frames)

License

Notifications You must be signed in to change notification settings

mirismaili/Android-FramesRotatorView

Repository files navigation

Android-FramesRotatorView

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" />

res/drawable/ic_spinner.xml:

ic_spinner.xml

Demo Video (with different sizes):

ic_spinner.xml

About

Android: A view that rotates discretely (between some number of frames)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages