夜间模式
来源:互联网 发布:电力系统仿真软件综述 编辑:程序博客网 时间:2024/04/28 18:20
//夜间白天
int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
SharedPreferences sp = getSharedPreferences("night", Context.MODE_PRIVATE);
if (mode == Configuration.UI_MODE_NIGHT_YES) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", false).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else if (mode == Configuration.UI_MODE_NIGHT_NO) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", true).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
int mode = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
SharedPreferences sp = getSharedPreferences("night", Context.MODE_PRIVATE);
if (mode == Configuration.UI_MODE_NIGHT_YES) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", false).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
} else if (mode == Configuration.UI_MODE_NIGHT_NO) {
SharedPreferences.Editor editor = sp.edit();
editor.putBoolean("night", true).commit();
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES);
}
阅读全文
0 0
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 夜间模式
- 教育奖得主说,有这种思维方式的孩子容易有更好的发展
- Activity启动流程概要
- 每日英语阅读(六十)
- “智慧燃气”来了, 抄表不用再上门,全国首个商业NB-IoT应用落地
- React Native Could not expand ZIP错误信息
- 夜间模式
- 关于Spring Cache的一些应用上的遗憾
- 记录 Spine骨骼动画导入unity 步骤[unity3d 4.6.6版本 2d动画]
- html5/Css3 自应式
- 踩坑:图片拍照上传等
- refreshBeanFactory
- HDU 6208 The Dominator of Strings (SAM)
- 实验一
- 多线程+队列(纯脚本)