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 “.Bridge" themes?

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: Theme.MaterialComponents.Light.NoActionBar.Bridge

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 MaterialComponents .

Solution

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:

Senior Android Engineer @WeTransfer 🤖 🇻🇪🇮🇹 Paraglider, Runner, Kayaker.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store