is there any way to make a SnackBar wrapping its text content?
You can look up my problem below:
As you can see the text ends at "contact us at...." and it should display the entire message.
Thank you!
setTextSize(24); //increase max lines of text in snackbar. default is 2. sbNoAct. show(); int height = sbView.
SnackBar takes a widget as a child. SnackBar takes the height of the child to render. When you pass a container with height 200 it will set the snack bar's height 200. scaffoldKey.
Snackbar in android is a new widget introduced with the Material Design library as a replacement of a Toast. Android Snackbar is light-weight widget and they are used to show messages in the bottom of the application with swiping enabled. Snackbar android widget may contain an optional action button.
If you want to add an icon to the right of a snackbar, you need to do the following: SpannableStringBuilder buildetTextRight = new SpannableStringBuilder(); buildetTextRight. append(" "); buildetTextRight.
I believe that snackbar by default limits you to only 2 lines.
One thing that you could try is setting the textview inside snackbar to be multiline. Like so:
View snackbarView = snackbar.getView();
TextView textView = (TextView) snackbarView.findViewById(android.support.design.R.id.snackbar_text);
textView.setMaxLines(5); //set the max lines for textview to show multiple lines
Let me know if that works or not
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With