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 your app/build.gradle
file dependencies with the following:
implementation 'androidx.coordinatorlayout: coordinatorlayout:1.2.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
Snackbar
is an Android widget that provides a brief message to a user at the bottom of the screen.
If you use any layout other than CoordinatorLayout
, Snackbar
with its message will be rendered on top of the floating action button. If we use CoordinatorLayout
as the parent view group, the layout will push the...