Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to apply MaterialComponents only to some widget?

I am migrating from AppCompat to MaterialComponents, and I would like to keep some widgets (like the Bottom Navigation Bar) AppCompat-themed. However, when I want to apply MaterialComponents theming to Buttons and TextFields, I must set my app theme to MaterialComponents.... and therefore all my widgets are MaterialComponents-themed. How can I make only some widgets MaterialComponents-themed ? I have been looking for an answer on StackOverflow but couldn't find anything.

like image 884
Vincent Avatar asked Sep 06 '25 00:09

Vincent


1 Answers

You can use Bridge themes like :

Theme.MaterialComponents.Bridge
Theme.MaterialComponents.Light.Bridge
Theme.MaterialComponents.NoActionBar.Bridge
Theme.MaterialComponents.Light.NoActionBar.Bridge
Theme.MaterialComponents.Light.DarkActionBar.Bridge

Bridge themes inherit from AppCompat themes, but also define the new Material Components theme attributes for you. If you use a bridge theme, you can start using Material Design components without changing your app theme. (From documentaion)

Have a look : Get started - Material Design

like image 65
DrHowdyDoo Avatar answered Sep 07 '25 20:09

DrHowdyDoo