Everything about Android Animations you were too afraid to ask
Submitted by Chaitanya Nettem (@chaitanyanettem) on Sunday, 2 July 2017
Animations in Android can be daunting with multiple moving parts and multiple ways of achieving similar results. From experience I have seen people just copying animation code from StackOverflow without really understanding how it all works. Understanding how the animation system works and what its limitations are is important to figuring out how and what you should animate in your app.
You’ll leave this talk having gotten a clear functional overview of everything about animations in Android including the newest Physics based Animation support library.
We will cover -
- View Animations (the oldest animation system in Android. Only allows you to animate views and the following properties - position, size, rotation, and transparency)
- Property Animations (Was introduced in Gingerbread. Allows you to animate objects other than views and also allows you to animate background colors)
- Drawable Animations (allows you to animate Drawables by creating a film roll effect where you split an animation into multiple drawables and show them one after the other)
- Transitions Framework
- Animation Sets
All of the above topics come under time based animation systems which means that you have to specify the time for which you want the animation to run.
The Android UI Toolkit team recently introduced Physics based animations where you don’t have to provide total time required for an animation. Instead you specify source, destination and velocity. This allows a bunch of new possibilities which we will cover. For instance if the destination of your view moves then the animation doesn’t abruptly stop after its time ends but continues until the destination is reached.
- Physics Based Animations
- Dynamic Animation
- Spring Animation
- Spring Force
- Fling Animation
This talk will be code heavy and gif heavy. We will go over sample code and demonstrate its effects.