I want to change the action text color for my snackbar, but it is not working for some reason.
I use the following code to display a snackbar:
Snackbar.make(findViewById(R.id.root), "text", Snackbar.LENGTH_LONG).setActionTextColor(R.color.yellow).setAction("OK", new View.OnClickListener() {
@Override
public void onClick(View view) {
}
}).show();
Use
instead of just
None of above answers helped me. I found this solution, and it works by changing manually the TextView's text color
The argument of
setActionTextColor
is theint
that represents the color, not the resource ID.Instead of this:
try:
If you want to use resources anyway, try:
Note: To use ContextCompat, I assume you have included Support library to your
build.gradle
file (It is optional if you have already appcompat (v7) library too).