Android Material Design Snackbar Example Kotlin

Android Material Design Snackbar Example Kotlin

Snackbars provide lightweight feedback about an operation. They show a brief message at the bottom of the screen on mobile and lower left on larger devices. Snackbars appear above all other elements on the screen and the only one can be displayed at a time. Snakebars are one of the components of Android Material Design. In this tutorial, we will learn Android Material Design Snackbar Example Kotlin.


Download Sourcecode


Simple SnackBar

Display Simple SnackBar Android, just put below code

Result is given below.



SnackBar With Action.

SnackBar With Action, used when you want some user interface while display message. just write

Result of above code is


Custom SnackBar

SnackBar With Text Color

you can customized SnackBar As per you theme color. you can chnage text color of action and message text.

result will be like


SnackBar With Image Action

You can use Icon while for action image

to Use icon as action for snackbar use below code

Result will be like


For full Example follow the steps.

Create Project.

Click File > New > Import Project.

follow the steps from developer site here.

Create dependancies

1 . build.gradle

Default Activity MainActivity will be created put below code in your file.


if you are using Kotlin then use below code.

3. KotlinActivity.kt

4. activity_main.xml

use below layout file code for your activity


5. activity_kotlin



Leave a Comment