我正在使用Xamarin.Forms,并且希望在所有页面中导航以具有#84DCC6。它添加了但我不希望导航页面的顶部具有蓝色(这是Android项目中的默认设置),我只希望具有#84DCC6一种颜色。这是我在App.xaml中的代码
<Application.Resources>
<ResourceDictionary>
<Style TargetType="NavigationPage">
<Setter Property="BarBackgroundColor" Value="#84DCC6" />
<Setter Property="BarTextColor" Value="Black" />
</Style>
</ResourceDictionary>
</Application.Resources>
我正在小米A2 Lite上测试我的App。任何建议只能是一种颜色#84DCC6
您正在谈论的蓝色不是导航栏,而是状态栏。
Android:
您可以从位于Android项目Resource folder
下的Styles.xml文件中更改其颜色:>
<!-- colorPrimaryDark is used for the status bar --> <item name="colorPrimaryDark">#1eb6ed</item>
iOS
在应用程序委托类中使用下面的代码
UIView statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
{
statusBar.BackgroundColor = color.ToUIColor();
}