在Android API级别上禁用Darkmode< 29(q)

发布于 2025-02-10 01:38:55 字数 228 浏览 3 评论 0原文

我将此行放入我的style.xml中,以在我的应用程序上禁用黑暗/夜间模式:

< item name =“ android:forcedarklowered”工具:targetapi =“ q” q“ q”> false</item>

当然,它适用于Android 10及更高版本。但是目前,我也想在以前的Android版本上禁用黑暗模式,但我找不到如何...

I put this line into my style.xml to disable dark/night mode on my app:

<item name="android:forceDarkAllowed" tools:targetApi="q">false</item>

and of course, it works for Android 10 and higher. But currently, I also want to disable dark mode on the previous android version, but i dont find how...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈场末日恋爱 2025-02-17 01:38:55

您可以尝试在每项活动中添加这些行的下方,并查看是否有效

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);

You Can try adding these line just below onCreate method in each and every activity and see if it works

AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文