0

在此处输入图像描述

我正在使用 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 上测试我的应用程序。任何建议只是一种颜色#84DCC6

4

1 回答 1

2

您所说的蓝色不是导航栏,而是状态栏。

安卓:

您可以从位于您的 android 项目下的 Styles.xml 文件更改其颜色Resource folder

<!-- colorPrimaryDark is used for the status bar -->
<item name="colorPrimaryDark">#1eb6ed</item>

iOS

在您的应用委托类中使用以下代码

var statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView;
            if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:")))
            {
                statusBar.BackgroundColor = UIColor.FromRGB(132, 220, 198);
                statusBar.TintColor = UIColor.Black;
            }
于 2020-01-30T08:34:00.863 回答