【问题标题】:Xamarin.Forms 4.0 Shell TitleView iOS cannot set black background colorXamarin.Forms 4.0 Shell TitleView iOS 无法设置黑色背景颜色
【发布时间】:2019-06-27 03:42:26
【问题描述】:

我正在为一家公司工作,该公司的品牌指南要求标题视图以黑色 (#000) 作为背景颜色。我正在使用 Xamarin.Forms 4.0 Shell 来构建应用程序。 Android运行良好,但iOS“没那么黑”。

为了演示这个问题,我使用官方示例“Xaminals”作为试验并将标题颜色更改为“黑色”。请看下面的结果图片。

iOS Screenshot

Android Screenshot

请查看我的代码是否有任何问题,以便为 iOS 标题视图背景颜色实现“Real Black”(#000)。提前致谢!

Sample 供参考。

【问题讨论】:

    标签: shell xamarin.forms colors background titleview


    【解决方案1】:

    标题视图放置在导航栏上。 iOS 上导航栏的默认设置(半透明)为 true。所以看起来不是很黑。

    如果你不想要这个效果,你可以在 iOS 项目中禁用它:

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

    【讨论】:

      猜你喜欢
      • 2019-11-10
      • 2010-11-18
      • 1970-01-01
      • 2012-06-04
      • 2014-03-29
      • 2014-11-03
      • 2017-05-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多