I have followed the guidelines to how to implement Material Components to my app and have assigned the Theme.MaterialComponents.NoActionBarto my AppTheme and in my main activity it has a CoordinatorLayout as mentioned in material.io to best display the Snackbar but i get this result.

enter image description here

Edit: I have tried to change the background color of the Snackbar in style as well as set a textViewStyle but those options didn't work

if more info is needed i will edit and add the missing info.

3 Answers

Vinoth Kumar On

You can change the text and background color like this.

  Snackbar snackbar = Snackbar
            .make(view, "Hello", Snackbar.LENGTH_SHORT);
    View sbView = snackbar.getView();
    TextView textView = sbView.findViewById(android.support.design.R.id.snackbar_text);

Alternate way to change the snackbar background color refer the link


If you have still any doubts share your sample code and if this answer is helpful give positive feedback.

jins joseph On

Use this code :

Mustafa Osta On

I have found the error as there was <item name="android:background">@color/white</item> overriding the TextView background color and even specifying the android:background in the specified style of the widget will not override the main background specified in the main AppTheme