So I\'ve started using the new Snackbar in the Design Support Library, but I found that when you define \"android:textColor\" in your theme, it applies to the text color of the
I also noticed the same problem. Thanks to the answers here I've created a small class, which can help to solve this problem in more easily, just by replacing this:
Snackbar.make(view, "Error", Snackbar.LENGTH_LONG).show();
with this:
Snackbar2.make(view, "Error", Snackbar.LENGTH_LONG).show();
Here is my class:
public class Snackbar2 {
static public Snackbar make(View view, int resid, int duration){
Snackbar result = Snackbar.make(view, resid, duration);
process(result);
return result;
}
static public Snackbar make(View view, String text, int duration){
Snackbar result = Snackbar.make(view, text, duration);
process(result);
return result;
}
static private void process(Snackbar snackbar){
try {
View view1= snackbar.getView();
TextView tv = (TextView) view1.findViewById(android.support.design.R.id.snackbar_text);
tv.setTextColor(Color.WHITE);
}catch (Exception ex)
{
//inform about error
ex.printStackTrace();
}
}
}