如何在Xamarin表单Android中更改导航栏文本颜色

问题描述:

我正在使用Xamarin Forms,我想在Android中更改Navigationbar的颜色. 我正在使用此代码:

Im using Xamarin Forms and i want to change color of Navigationbar in Android. Im using this code:

MainPage = new NavigationPage { BarBackgroundColor = Color.Lime, BarTextColor = Color.Purple };

MainPage = new NavigationPage { BarBackgroundColor = Color.Lime, BarTextColor = Color.Purple };

第一个属性(BarBackgroundColor)有效,第二个属性不起作用(BarTextColor).

The first property (BarBackgroundColor) was worked, second property not worked (BarTextColor).

请好心回答我.

您可以在app.xaml中进行设置,它将覆盖它

you can set in your app.xaml and it will override it

  <Style TargetType="NavigationPage">
    <Setter Property="BarBackgroundColor" Value="Red"/>
    <Setter Property="BarTextColor" Value="White"/>
  </Style>


</ResourceDictionary>