Mai
Mai

Reputation: 13

android:background not work on button with theme Theme.MaterialComponents.DayNight.DarkActionBar

android:background and android:textColor not working on Button when application theme is "Theme.MaterialComponents.DayNight.DarkActionBar", but is works when theme "Theme.MaterialComponents.DayNight.DarkActionBar.Bridge".

I want to know why and how to fix this issue without changing the theme.

Upvotes: 1

Views: 1980

Answers (1)

Narendra_Nath
Narendra_Nath

Reputation: 5185

Ref:https://material.io/develop/android/docs/getting-started/

Bridge themes inherit from AppCompat themes, but also define the new Material Components theme attributes for you.

So if your button is not changing according to your wish you can use one of the bridge themes.

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

Upvotes: 3

Related Questions