xaml - 如何在使用 xamarin shell 时更改状态栏颜色

我正在使用 Xamarin Shell 来显示抽屉导航和一些选项卡。 我需要更改状态栏颜色。我搜索了很多解决方案,但当我们不选择基于 Xamarin shell 的抽屉导航时,一切正常。

最佳答案

我们可以设置资源字典中Shell导航栏的样式

   <Shell.Resources>
        <ResourceDictionary>
            <Color x:Key="NavigationPrimary">#2196F3</Color>
            <Style x:Key="BaseStyle" TargetType="Element">
                <Setter Property="Shell.BackgroundColor" Value="Red" />  // set navigation bar color here
                <Setter Property="Shell.ForegroundColor" Value="Blue" />
                <Setter Property="Shell.TitleColor" Value="Blue" />
                <Setter Property="Shell.DisabledColor" Value="#B4FFFFFF" />
                <Setter Property="Shell.UnselectedColor" Value="#95FFFFFF" />
                <Setter Property="Shell.TabBarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
                <Setter Property="Shell.TabBarForegroundColor" Value="White"/>
                <Setter Property="Shell.TabBarUnselectedColor" Value="#95FFFFFF"/>
                <Setter Property="Shell.TabBarTitleColor" Value="White"/>
            </Style>
            <Style TargetType="TabBar" BasedOn="{StaticResource BaseStyle}" />
        </ResourceDictionary>
    </Shell.Resources>

https://stackoverflow.com/questions/60327484/

相关文章:

google-cloud-bigtable - BigTable是否允许设置微时间戳粒度

reactjs - 在 react-testing-library 中使用 getByRole 按可

node.js - 找不到 NodeJS nodegui 模块

vue.js - 元标记在 Nuxt.js 应用程序的页面源中无法正确显示

amazon-web-services - 如何让我的 Auth0 权限进入 AWS HTTP AP

googlebot - 是否可以让 fail2ban 忽略谷歌?

sql-server - SSIS:发生 OLE DB 错误。错误代码 0x80004005,对方过

reactjs - 如何测试 componentWillUnmount

r - 无法在 R Studio 中安装包

ios - 如何不从照片库 iOS 中获取屏幕截图