Custom Snackbar

suggest change

This example shows a white Snackbar with custom Undo icon.

Snackbar customBar = Snackbar.make(view , "Text to be displayed", Snackbar.LENGTH_LONG);
customBar.setAction("UNDO", new View.OnClickListener() {
    public void onClick(View view) {
    //Put the logic for undo button here


View sbView = customBar.getView();
//Changing background to White

TextView snackText = (TextView) sbView.findViewById(; 
if (snackText!=null) {
    //Changing text color to Black

TextView actionText = (TextView) sbView.findViewById(;
if (actionText!=null) {
    // Setting custom Undo icon
    actionText.setCompoundDrawablesRelativeWithIntrinsicBounds(R.drawable.custom_undo, 0, 0, 0);

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents