nispok/snackbar

Make a SnackbarType.INFINITY_LINE

passsy opened this issue · 4 comments

I really need to show more than 2 lines. I fixed it but the fix is ugly. Please support more than 2 lines against the material design rules.

     final Snackbar snackbar = Snackbar.with(this)
                .text(error)
                .actionLabel(R.string.close)
                .duration(Snackbar.SnackbarDuration.LENGTH_LONG)
                .dismissOnActionClicked(true)
                .type(SnackbarType.MULTI_LINE);
        snackbar.show(this);

        // fix: Snackbar doesn't support more than 2 lines.
        TextView snackbarText = (TextView) snackbar.findViewById(R.id.sb__text);
        snackbarText.setMaxLines(25);
        snackbar.setMaxHeight(ViewHelper.dpToPx(context, 400));
        snackbar.requestLayout();

I don't think this is a "bug", or that it needs to be "fixed". 2 lines is by the book according to the Material Design spec, if you're trying to show more then I think you should use an alternative UI

I agree with @hzsweers, the MD spec define that Snackbars are meant for quick messages and shouldn't have more than two lines. What type of content are you trying to show in it?

I use it for quick and short messages. But on some devices and some languages the strings are longer than 2 lines.

Sample:

Something went wrong. Please call the info line. | Call

If the text is cut off and only shows "Something went wrong. Please call th...." the users don't know what to do. So what should I do? Showing a dialog because the translations in german is 10% too long for a Samsung Galaxy SII?

No, that's not a problem I want to deal with. I just want to show the entire error message to the user.

Btw: It doesn't look bad ;)

That would be a better served as a (maybe custom) toast then.

On February 8, 2015 at 9:39:05 AM, Pascal Welsch (notifications@github.com) wrote:

I use it for quick and short messages. But on some devices and some languages the strings are longer than 2 lines.

Sample:

Something went wrong. Please call the info line. | Call

If the text is cut off and only shows "Something went wrong. Please call th...." the users don't know what to do. So what should I do? Showing a dialog because the translations in german is 10% too long for a Samsung Galaxy SII?

No, that's not a problem I want to deal with. I just want to show the entire error message to the user.

Btw: It doesn't look bad ;)


Reply to this email directly or view it on GitHub.