val configuration = resources.configuration
configuration.uiMode = configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK
delegate.localNightMode = when (configuration.uiMode) {
Configuration.UI_MODE_NIGHT_YES -> AppCompatDelegate.MODE_NIGHT_NO
Configuration.UI_MODE_NIGHT_NO -> AppCompatDelegate.MODE_NIGHT_YES
else -> {
AppCompatDelegate.MODE_NIGHT_YES
}
}
recreate()
日夜切换(动画效果会被重置)
最新推荐文章于 2023-08-27 12:29:09 发布