Skip to content

Instantly share code, notes, and snippets.

@darland6
Created January 6, 2016 20:40
Show Gist options
  • Select an option

  • Save darland6/9c27406c38feba63f5b7 to your computer and use it in GitHub Desktop.

Select an option

Save darland6/9c27406c38feba63f5b7 to your computer and use it in GitHub Desktop.
//generate the snackbar
Snackbar sb = Snackbar.make(rootView, snack.text, duration);
//set te action button text color
sb.setActionTextColor(mCurrentActivity.getResources().getColor(R.color.snack_text_action));
//Get the view of the snackbar
View sbView = sb.getView();
//set background color
sbView.setBackgroundColor(mCurrentActivity.getResources().getColor(backgroudResId));
//Get the textview of the snackbar text
TextView textView = (TextView) sbView.findViewById(android.support.design.R.id.snackbar_text);
//set text color
textView.setTextColor(mCurrentActivity.getResources().getColor(R.color.snack_text));
//increase max lines of text in snackbar. default is 2.
textView.setMaxLines(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment