【问题标题】:Color automatically change with mobile darkmode颜色随手机暗色模式自动变化
【发布时间】:2022-01-08 19:43:57
【问题描述】:

如果目标设备启用了暗模式,谁能告诉我为什么我在Xamarin.Forms 应用程序中的颜色会发生变化。 这是我的代码:

<Setter Property="BackgroundColor" Value="{ AppThemeBinding Dark=#99f2c8}" />

AppShell.xaml 我将FlyoutBackgroundColor 设置为#ffff

当我的设备处于光照模式时,我们会看到如下内容:

enter image description here

如果它处于黑暗模式,我们将看到: enter image description here

我的颜色会自动变暗。如何预防?

【问题讨论】:

    标签: c# android .net xamarin xamarin.android


    【解决方案1】:

    你有小米吗?

    启用暗模式后,会出现一个新菜单:“更多暗模式选项”。您可以在此处关闭“自动调整文本和背景”以解决问题。

    据我所知,Yoy 无法控制 Xamarin 中的这些额外设置,因此大多数用户不会受到影响。

    【讨论】:

    • 是的,你是对的,我正在小米上测试它。但是如果在 kotlin 中发生这样的事情,我们可以用代码修复它吗?
    • 不确定这是否适用于小米,但请尝试将 App_Resources/Android/src/main/res/values/styles.xml 中的 &lt;item name="android:forceDarkAllowed"&gt;true&lt;/item&gt; 设置为 false
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-27
    • 2020-07-29
    • 2014-01-27
    • 2021-10-18
    • 2013-06-24
    • 2018-10-22
    • 1970-01-01
    相关资源
    最近更新 更多