0

When I show the snackbar the text appears on the top. I'm talking about the text, not the snackbar. The next picture shows this behaviour:

enter image description here

I'm using the library of com.rey.material.widget (https://github.com/rey5137/Material/wiki/SnackBar), and this is the piece of code I'm dealing with:

SnackBar.make(this)
  .singleLine(true)
  .text("This is a message")                                                                   
  .textColor(getResources().getColor(R.color.white_text_color))
  .duration(getResources().getInteger(R.integer.snackbar_dismiss_timer))
  .show(this);

What can I do? Any clue? Thanks in advance!

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
Rafa0809
  • 1,733
  • 21
  • 24
  • Have you tried using the [official Snackbar[(http://developer.android.com/reference/android/support/design/widget/Snackbar.html), part of the [Android Design Support Library](http://android-developers.blogspot.com/2015/05/android-design-support-library.html)? – ianhanniballake Jan 17 '16 at 19:40
  • 1
    It's like a bug, i'd rather to use default snakebar with default android library.and also, i would rather to open an issue for that library on github too. – ʍѳђઽ૯ท Jan 17 '16 at 20:35

1 Answers1

2

I HIGHLY recommend you to use standard com.android.support library. I worked around one hour to fix this problem and I give up. I'm sure that it's definetely problem with a library.

I tried:

  • .setPadding() - no matter what values you would add text wouldn't be seen
  • .textAppearence() - the same situation
  • .setForeground() - as above

Actually, I don't see any new option, that hasn't been already tested

To see how buggy it is, use code like below:

    SnackBar.make(this)
            .singleLine(true)
            .text("This is a message")
            .textColor(getResources().getColor(R.color.colorPrimary))
            .duration(2000)
            .backgroundColor(R.color.colorAccent)
            .textAppearance(View.TEXT_ALIGNMENT_CENTER)
            .show();

[I won't tell you what you would see, just give a try]

Sorry, but there's no reason to use this library instead of great MaterialDesign lib, as it has that kind of problems and it needs libs, that already have standard Snackbar library.

If you still think that Google's Snackbar is not an option, have a look at these alternatives: http://android-arsenal.com/tag/234

Hope it help

piotrek1543
  • 19,130
  • 7
  • 81
  • 94
  • 1
    That not worked for me, but taking into account your insistence on use the official design library I decided include it on my implementation. Thanks for provide a direct answer to the issue and you advice. Thank you! – Rafa0809 Jan 17 '16 at 20:39