Search code examples
shellxamarin.formscolorsbackgroundtitleview

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


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.


Solution

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