【问题标题】:Xamarin forms: Statusbar doesn't update color when NavBar changes color on AndroidXamarin 表单:当导航栏在 Android 上更改颜色时,状态栏不会更新颜色
【发布时间】:2017-08-11 20:05:35
【问题描述】:

我正在使用 Xamarin Forms 制作应用程序。 通常应用程序会有一个蓝色的 NavBar,但我正在为特定页面更改 NavBar。

我这样做的方法是:

    InitializeComponent();
     var navigationPage = Application.Current.MainPage as NavigationPage;
     navigationPage.BarBackgroundColor = Color.FromHex("#99CC07");

但是状态栏没有更新它的颜色:

如何使状态栏与导航栏具有相同的颜色(阴影)? 在 iOS 上它工作得很好。

【问题讨论】:

    标签: xamarin xamarin.forms


    【解决方案1】:

    您可以在 Android 项目中修改这两种颜色。转到资源 > 值 > styles.xml 并编辑以下值:

    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#0066A1</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#0E4369</item>
    

    【讨论】:

      猜你喜欢
      • 2015-05-07
      • 1970-01-01
      • 1970-01-01
      • 2015-03-16
      • 1970-01-01
      • 1970-01-01
      • 2018-02-06
      • 1970-01-01
      相关资源
      最近更新 更多