Implementing new Android’s snackbar style on “.Bridge” themes
If you go to the
material.io website and check for the snackbar designs, you will see new something like this:
Which is something a bit different to what we used to have before:
where the snackbar was not floating but was reaching the edges of the view/screen.
What about “.
If you use one of the
MaterialComponents themes (For example
Theme.MaterialComponents.Light) then you will automatically have this new style!
But what if you have a
Bridge theme? For example:
As stated in the docs, a
.Bridge theme inherits
AppCompat themes, but also define the new Material Components theme attributes for you.
But in this case, for some reason, you will still have the old snackbar style, even if the theme is part of the
Luckily there is a solution for this situation :)
We just need to override the
snackbarStyle using the newest one.
So, we will end up with something like this: