【问题标题】:How to change Android ActionBar color in Xamarin App.Shell如何在 Xamarin App.Shell 中更改 Android ActionBar 颜色
【发布时间】:2021-01-31 21:52:22
【问题描述】:
我正在使用带有 .netstandard 2.1 的 Xamarin 开发应用程序,但找不到更改 android 应用程序操作栏的方法。
蓝色条不是我想要的颜色,并且按照互联网上的所有文档和教程,我什至找到了一种更改状态栏(时钟、电池和通知所在的位置)的方法,但无法更改这蓝色到橙色。
谁能告诉我我应该做错什么吗?
谢谢
【问题讨论】:
标签:
xamarin
xamarin.forms
xamarin.forms.shell
.net-standard-2.1
【解决方案1】:
在<Shell> 级别全局设置附加属性BackgroundColor="Red":
<Shell
...
BackgroundColor="Red">
或在ContentPage 级别使用:
<ContentPage
...
Shell.BackgroundColor="Red">
请注意,这将影响导航栏(您描述的那个)以及上部选项卡(TabBar)。
【解决方案2】:
在您的 shell 应用 xaml 文件中,在顶部使用 Shell.BackgroundColor="Red"。
<Shell xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:App1.Views"
Title="App1"
x:Class="App1.AppShell"
Shell.BackgroundColor="Red"
>