Snack Bar


Min SDK : 10
Price : Free
Language : Java



Link : Github
Owner : Kennyc1012
Source Code : Download



With the addition of Snackbars to the android design support library this library is no longer under development.


#Designed after the docs at Google Material Design



    • Customization including message, action message, action color, message color, background color, action click handle, animation duration, animation interpolator, typeface, and text appearance
    • Tablet support
    • Swipe to dismiss
    • Callbacks for the different SnackBar states (started, actionClicked, finished)
    • One Message at a time
    • XML Style support

#Using SnackBar

Using SnackBar is simple, just one line of code is needed!, R.string.hello_world);

Or if you want to set an action, R.string.hello_world, R.string.undo, onClickListener);


SnackBars can be customized by creating a SnackBarItem with the Builder factory

 new SnackBarItem.Builder(getActivity())

###SnackBars can also be styled via the application theme
The following attributes can be used for styling a SnackBar

   <attr name="snack_bar_background_color" format="color" />
<attr name="snack_bar_text_color" format="color" />
<attr name="snack_bar_text_action_color" format="color" />
<attr name="snack_bar_duration" format="integer" />
<attr name="snack_bar_interpolator" format="reference" />
<attr name="snack_bar_message_typeface" format="string" />
<attr name="snack_bar_action_typeface" format="string" />
<attr name="snack_bar_message_text_appearance" format="reference" />
<attr name="snack_bar_action_text_appearance" format="reference" />
<attr name="snack_bar_offset" format="reference" />
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowBackground">@color/background_material_light</item>
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="snack_bar_text_color">@color/my_color</item>
<item name="snack_bar_duration">5000</item>

Receive callbacks from SnackBars with an Object

// Called when the SnackBar begins to animate
publc void onSnackBarStarted(Object object){
// Called when the SnackBar finishes with its animation
// Will be called if the action button is pressed
public void onSnackBarFinished(Object object, boolean actionPressed){

Canceling SnackBars

When your activity goes into a Paused or Destroyed state, remove the SnackBars from the queue


#Including in your project
To include SnackBar in your project, add the following to your build.gradle file.

repositories {
maven { url '' }
dependencies {
compile 'com.kennyc:snackbar:2.5'

Pull requests are welcomed and encouraged. If you experience any bugs, please file an issue