Android Webview:Don' t倒置图像中的黑暗主题

发布于 2025-02-03 02:48:56 字数 409 浏览 2 评论 0原文

我们的应用程序中有几个WebViews,在尝试实现深色主题时,我们使用以下设置:

WebSettingsCompat.setForceDark(settings, WebSettingsCompat.FORCE_DARK_ON)
WebSettingsCompat.setForceDarkStrategy(settings, WebSettingsCompat.DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING)

问题是大多数页面都没有定义深层网络主题,因此用户代理人的变暗为用过的。文本内容正常工作,但是如果网络内容中有图像,它们的颜色也会反转,从而产生了非常奇怪的外观。

是否可以选择将图像排除在用户代理黑暗中?我在官方文档中没有找到有关此文件的任何文件。

We are having a couple of WebViews in our app, and when trying to implement the dark theme we use the following settings:

WebSettingsCompat.setForceDark(settings, WebSettingsCompat.FORCE_DARK_ON)
WebSettingsCompat.setForceDarkStrategy(settings, WebSettingsCompat.DARK_STRATEGY_PREFER_WEB_THEME_OVER_USER_AGENT_DARKENING)

The problem is that most of the pages doesn't have the dark web theme defined, so the user-agent darkening is used. Text content is working correctly, but if there are images in the web content their colors are inverted as well, resulting in a really strange look.

Is there any option to exclude images from the user-agent darkening? I haven't found any documentation about this in the official docs.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文