MIUI 12.01系统更新已将我的应用更改为夜间模式。如何关闭夜间模式?

huangapple go评论112阅读模式
英文:

MIUI 12.01 System Update had changed My App to Night Mode.How to disable Night Mode?

问题

在 Application 类中,我已经添加了:

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

为什么它不起作用?

英文:

In Application class I have added:

 AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

Why is it not working ?

答案1

得分: 6

我已通过添加以下内容解决了这个问题:

在App主题中添加了:

<item name="android:forceDarkAllowed">false</item>

在App主题中:

<style name="AppThemeLight" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="android:forceDarkAllowed">false</item>
</style>
英文:

I have fixed this issue by adding

&lt;item name=&quot;android:forceDarkAllowed&quot;&gt;false&lt;/item&gt;

in Apptheme

 &lt;style name=&quot;AppThemeLight&quot; parent=&quot;Theme.AppCompat.Light.NoActionBar&quot;&gt;
    &lt;item name=&quot;android:forceDarkAllowed&quot;&gt;false&lt;/item&gt;
&lt;/style&gt;

huangapple
  • 本文由 发表于 2020年10月14日 15:16:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/64348366.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定