Android Snackbar :

android-snakbar-example

Snackbar in introduced in Android material design. Its work same as Toast widget to show short time Message or Feedback. But Snackbar also provide control on some action (Like Undo, Retry , Cancel etc). You can also change color of Snackbar and text.

How to use Android Snackbar :

Create new Android project (How to create new project)

1.  Add library in gradle:app (ProjectName>app>build.gradle(app))

Android design library 24.2.0 (version always changing by Android team so always update android SDK and Tools)

Complete code for adding dependency in build.gradle

2. Add following code in app>src>main>res>layout>”activity_main.xml”

CoordinatorLayout is act as container of perform child view action .

3. Add following code in app>src>main>java>”MainActivity.java”

Output Screen shot

android-snackbar-example-code

Source code link

https://github.com/eyehunt/SnackbarAndroid

Development environment

Android Studio : 2.1.3
compileSdkVersion 24
buildToolsVersion “24.0.1”
minSdkVersion 15 (Ice Cream Sandwich)
targetSdkVersion 24 (Nougat)

Leave a Reply