Android夜间模式监听
作者:互联网
夜间模式
override fun onConfigurationChanged(newConfig: Configuration) {
val nightModeFlags = getContext().resources.configuration.uiMode and
Configuration.UI_MODE_NIGHT_MASK
when (nightModeFlags) {
Configuration.UI_MODE_NIGHT_YES -> {
//TODO
}
Configuration.UI_MODE_NIGHT_NO -> {
//TODO
}
Configuration.UI_MODE_NIGHT_UNDEFINED -> {
}
}
super.onConfigurationChanged(newConfig)
}
标签:夜间,onConfigurationChanged,nightModeFlags,UI,MODE,NIGHT,Android,Configuration,监听 来源: https://blog.csdn.net/u010436867/article/details/122676360