magicmushroom
magicmushroom

Reputation: 41

Using Snackbar for 5.0+ devices

So I want to create an app supporting Lollipop & above devices ONLY.

But I have a use case that demands the need for a Snackbar with an UNDO option. After reading up, it seems I have to :

Is this really the only way to use a basic functionality like Snackbar - having to rewrite everything elsewhere?

Please please tell me there is a better way out. This just does not make any sense!

Upvotes: 2

Views: 388

Answers (2)

Ankit Bansal
Ankit Bansal

Reputation: 1811

As per the exception trace you added in the comments, I think this is caused due to the fact that you have not added dependency for 'com.android.support:design:23.1.1' in your build.gradle file.

Except this CoordinatorLayout is just used to place the floating actions which can move up/down when snack bar is shown

Upvotes: 0

CommonsWare
CommonsWare

Reputation: 1007554

Is this really the only way to use a basic functionality like Snackbar - having to rewrite everything elsewhere?

Whether or not you need a CoordinatorLayout depends on where and how you are showing the Snackbar.

Beyond that, though, to use the official Snackbar implementation without modification, you have to go through all those shenanigans.

You are welcome to use independent implementations of the snackbar pattern, such as this one that I use. AFAIK they have all been discontinued by their authors, in favor of the official implementation.

Upvotes: 2

Related Questions