【问题标题】:BarBackgroundColor not working in a Xamarin Forms appBarBackgroundColor 在 Xamarin Forms 应用程序中不起作用
【发布时间】:2019-05-10 21:48:05
【问题描述】:

在下面的第 20 行,我正在尝试将 Xamarin Forms 应用程序中的 BarBackgroundColor 设置为蓝色,RGB 值为 0 69 140...

0 69 140 颜色应该导致...

Google Color Picker

但是应用中的背景颜色看起来像......

谁能看到我做错了什么,以及如何更改颜色以匹配所需的蓝色? Android 端的颜色也相同。

【问题讨论】:

    标签: xamarin xamarin.forms


    【解决方案1】:

    如果你阅读docs,你会看到构造函数

    public Color (double r, double g, double b);
    

    将值限制在 [0..1] 之间

    您应该使用FromRGB 静态方法

    var color = Color.FromRGB(0, 69, 140);
    

    接受 [0-255] 范围内的 int 参数

    【讨论】:

    • 我自己刚刚发现的。我应该先看看那里,谢谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多