material-components / material-components-android

Modular and customizable Material Design UI components for Android
Apache License 2.0
16.42k stars 3.08k forks source link

[SwitchCompat] Uses wrong "off" color in Theme.Material3.DayNight #3295

Closed gmikhail closed 1 year ago

gmikhail commented 1 year ago

Description: The bug appears when using app theme Theme.Material3.DayNight, but not appears in default theme Theme.MaterialComponents.DayNight.

Screenshot 2023-03-08 102548

Note: this problem related to this issue ( https://issuetracker.google.com/issues/271871302 ) because androidx.preference:preference library seems to use the same widget component by default.

Expected behavior: Similar look like in app theme Theme.MaterialComponents.DayNight.

Screenshot 2023-03-08 110817

Android API version: 30

Material Library version: 1.8.0

drchen commented 1 year ago

Hi, Material themes are supposed to work with Material components. It's not guaranteed that AppCompat components will be styled correctly with Material themes. : )

I'll close this as working as intended.

dsn5ft commented 1 year ago

Also this is how you can have preferences use a MaterialSwitch:

https://github.com/material-components/material-components-android/issues/2828#issuecomment-1187563903