Xamarin.Forms 4.0 Shell TitleView iOS无法设置黑色背景色 [英] Xamarin.Forms 4.0 Shell TitleView iOS cannot set black background color

查看:184
本文介绍了Xamarin.Forms 4.0 Shell TitleView iOS无法设置黑色背景色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为一家品牌要求标准标题为黑色(#000)作为背景色的公司工作.我正在使用Xamarin.Forms 4.0 Shell来构建应用程序. Android运行良好,但iOS不是那么黑".

I am working for a company that brand guideline requesting title view having black (#000) as background color. I am using Xamarin.Forms 4.0 Shell to build the app. Android is working great but iOS is "not that black".

为演示该问题,我使用官方示例"Xaminals"作为试用版,并将标题颜色更改为"Black".请在下面查看生成的图像.

To demonstrate the problem, I am using official example "Xaminals" as trial and changing the title color to "Black". Please see the resulting image below.

iOS屏幕截图

Android屏幕截图

请查看我的代码是否有问题,以便为iOS标题视图背景色实现纯黑"(#000).预先感谢!

Please see if there are anything wrong with my code in order to achieve "Real Black" (#000) for iOS title view background color. Thanks in advance!

示例.

推荐答案

标题视图位于导航栏上.并且iOS上导航栏的默认设置(半透明)为true.所以看起来好像不是真的黑色.

The title view is placed on the Navigation bar. And the default setting(translucent) for navigation bar on iOS is true. So it looks like not really black.

如果您不希望这种效果,可以在iOS项目中将其禁用:

If you don't want this effect you can disable it on iOS project:

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
    global::Xamarin.Forms.Forms.Init();
    LoadApplication(new App());

    UINavigationBar.Appearance.Translucent = false;

    return base.FinishedLaunching(app, options);
}

这篇关于Xamarin.Forms 4.0 Shell TitleView iOS无法设置黑色背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆