0
点赞
收藏
分享

微信扫一扫

Android夜间模式监听

上古神龙 2022-01-24 阅读 158

夜间模式

 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)
    }
举报

相关推荐

0 条评论