We can create animations using both android.animation package and android.transition package but I would like to know what is the main difference between these packages since even custom transitions also use animator's from android animation package.
An animation is a special effect that applies to a single element on a slide such as text, a shape, an image, and so on. A transition is the special effect that occurs when you exit one slide and move on to the next during a presentation.
Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.
The animations are basically of three types as follows: Property Animation. View Animation. Drawable Animation.
From the documentation of android.animation
:
These classes provide functionality for the property animation system, which allows you to animate object properties of any type.
From the documentation of android.transition
:
The classes in this package enable "scenes & transitions" functionality for view hiearchies.
From there a conclusion could be made that android.animation
mostly handles individual View animation (a FAB moving left upon click, etc) while android.transition
cares mostly about view hierarchy/layout transition animation (Material Design shared elements, etc).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With