Snackbars are a great way to show feedback and messages to the users. Snackbars show a message at the bottom of a mobile or lower-left on larger devices. They can also have an action button. They automatically disappear after the timeout or after user interaction or if the user swipes on the snackbar.
In this recipe, we will learn how to easily show a Snackbar using Anko layouts. Showing Snackbars in the traditional way is a bit long; Anko makes it simpler to quickly show snackbars. Let's see how.
I'll be using Android Studio 3 to write code. You can get started by creating a new project in Kotlin with a blank activity in Android Studio 3+, as we won't be using any code from other recipes. You also need an intermediate understanding of Android development. Ensure that you have added Anko layouts dependencies to your project (follow the recipe Setting up Anko library for Anko layouts in gradle, in this chapter).