Killiam Killiam - 1 year ago 117
Android Question

Snackbar not showing action text

How do I get the Snackbar to show the "UNDO" or "RETRY" text on the right hand side?

I've tried

but it has no effect.

Snackbar.make(getView(), "Profile saved!", Snackbar.LENGTH_LONG)
.setAction(R.string.snackbar_action_undo, null)
.setActionTextColor(ContextCompat.getColor(getActivity(), R.color.ColorBrightAccent))

I've also tried

Snackbar.make(getView(), "Profile saved!", Snackbar.LENGTH_LONG)
.setAction(R.string.snackbar_action_undo, null)


<string name="snackbar_action_undo">UNDO</string>

There is no "UNDO" beside "Profile saved!".
I can't see the "UNDO" text

I've looked at the solution here, but it seems to apply to the text on the left-hand side.

Any help would be appreciated.

rib rib
Answer Source

Maybe try to add a action with a OnClickListener

Snackbar snackbar = Snackbar.make(v, "Profile saved!", Snackbar.LENGTH_INDEFINITE)
                    .setAction("UNDO", new View.OnClickListener() {
                        public void onClick(View view) {
                            Log.e("TAG", "Done");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download