This repository accompanies a blog post I wrote on Android Design Patterns on animated icons.
It contains over 25 AnimatedVectorDrawable
s that you can refer to free of charge. You know... cool animated icons like these!
...or these!
...or this!
...and also this!
...and a bunch of others too!
Additional icon implementations are welcome if you've written anything cool that you want to share... submit a pull request! :)
This sample app uses a minSdkVersion
of 21. However, there is a good amount of stuff in here that could still
be used on older platform versions:
-
VectorDrawableCompat
andAnimatedVectorDrawableCompat
can for the most part be used on pre-Lollipop devices with a couple of restrictions (continue reading below). Read Chris Banes' blog post for more information. Note that even though this app uses aminSdkVersion
of 21, it is still advantageous to use theVectorDrawableCompat
support library implementation (as it fixes some framework bugs that existed on API versions 21-22). -
Specifying tints, tint modes and/or theme attributes in
VectorDrawable
XML is supported on all platform versions. Read this blog post for more information. -
AnimatedStateListDrawable
is not supported on pre-Lollipop devices. However, it is only being used in this project for convenience and is not strictly required (not using it just means you'll need to manually start theAnimatedVectorDrawable
s yourself). -
Path morphing (i.e. animating the
android:pathData
attribute using anObjectAnimator
) is not supported on pre-Lollipop devices. Sorry! -
Using the
android:property{X,Y}Name
attributes in anObjectAnimator
's XML is not supported on pre-Lollipop devices. These new attributes correspond to theObjectAnimator#ofFloat(Object, String, String, Path)
method, which was only added in API 21. -
Defining custom
PathInterpolator
s in XML is not supported on pre-Lollipop devices. -
Using the new material design interpolators (such as
@android:interpolator/fast_out_slow_in
, etc.) is not supported on pre-Lollipop devices. See the documentation forandroid.R.interpolator
for a complete listing of interpolators that can be declared in XML at each platform version. Usually you can get a pretty similar effect using the decelerate and accelerate interpolators, although it won't be identical.
- On Android 5.0 and 5.1, some icons appear blurry and aren't tinted properly. See this bug thread for more information.