Snackbar animation android

Avijit Karmakar picture Avijit Karmakar · May 17, 2016 · Viewed 7.5k times · Source

Can I disable the default Snackbar animation in android? If yes then how? Please give me an example.

Also, I want to know how to set a custom animation on Snackbar. Then how can I set the animation on Snackbar? Please give me a detailed explanation of that.

Thanks in advance.

Answer

SqueezyMo picture SqueezyMo · May 17, 2016

As of android.support.design.widget.Snackbar, you can't do that since the animation is hardcoded (note private methods animateViewIn() and animateViewOut()). So your best bet is to use some third-party view. For example, this library mimics the behavior of a stock SnackBar and allows you to set your own custom animation right in your xml with sb_inAnimation and sb_outAnimation.