Animations with CoordinatorLayout
CoordinatorLayout
is a layout that handles the motions between its child views. When you use CoordinatorLayout
as the parent view group, you can animate the views inside it with little effort. You can add CoordinatorLayout
to your project by adding in your app/build.gradle
file dependencies with the following:
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
This will allow us to use CoordinatorLayout
in our layout files.
Let's say we have a layout file with a floating action button inside CoordinatorLayout
. When tapping on the floating action button, the UI displays a Snackbar
message.
Note
A Snackbar
is an Android widget that provides a brief message to the user at the bottom of the screen.
If you use any layout other than CoordinatorLayout
, the Snackbar with the message will be rendered on top of the floating action button. If we use CoordinatorLayout
as the parent view group, the layout will...