Xamarin.Forms 4.0 Shell TitleView iOS cannot set black background color

你。 提交于 2019-12-24 11:15:49

问题


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".

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 Screenshot

Android Screenshot

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!

Sample for reference.


回答1:


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.

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);
}


来源:https://stackoverflow.com/questions/56783581/xamarin-forms-4-0-shell-titleview-ios-cannot-set-black-background-color

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!