简体   繁体   中英

How to disable Darktheme when using Jetpack compose in Android app?

I have an Android app and it is currently in MVP state some of the users use their phone in Dark mode. There is no time to optimize for Dark theme.

I already tried passing same light theme colors to the Material theme does not work.

Also tried this but didn't work,

AppTheme(false) {
  content()
}

because theme composable says,

fun AppTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable() () -> Unit) {
}

Thanks Philip Dukhov for reference, basically need to use a descendant of

Theme.MaterialComponents.Light

in themes.xml

You can disable night mode in Theme.kt(in UI Theme Folder) by changing @Composable fun BuisnessCardTheme(darkTheme: Boolean = isSystemInDarkTheme(), content: @Composable () -> Unit)

into @Composable fun BuisnessCardTheme(darkTheme: Boolean = false, content: @Composable () -> Unit)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM