1

I know Snackbar is just to show a short message.But for one of my it's asking me to print multiple line.Is that possible ?

Sandip Subedi
  • 1,039
  • 1
  • 14
  • 34

2 Answers2

13

By Default it only support max of 2 lines. if you want to increase it you can change the attribute of setting Max line of snackBar textview by below way.

View yourSnackBarView = snackbar.getView(); //get your snackbar view
TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text); //Get reference of snackbar textview
textView.setMaxLines(3); // Change your max lines
Bhavesh Patadiya
  • 25,740
  • 15
  • 81
  • 107
-1

Yes, it's possible. You can try to put "\n" in between your lines. (Although, It may not look nice to put many lines on a snackbar)

Example:

Snackbar.make(view, "This is first line\nThis is second line", Snackbar.LENGTH_SHORT).show();
Hungry Coder
  • 1,800
  • 17
  • 22