我正在编写一个 .NET MAUI 解决方案,该解决方案应该在 Android 上运行,目前有两个页面。当我启动它时,程序运行良好,如下所示:
我还添加了一个弹出菜单,我最初认为该菜单不存在,因为菜单行显示为白色。当我点击弹出菜单所在的位置时,新页面出现了。
所以我的问题是,我最初如何更改标题栏的背景颜色?
我查看了有关如何更改背景颜色的视频,但无法找到任何答案。
我不确定问题是什么,或者您尝试过什么,但要更改每页的导航栏,您将
Shell.BackgroundColor
添加到 ContentPage
:
<ContentPage
x:Class="MauiTest.MainPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
Shell.BackgroundColor="Blue"
Shell.NavBarIsVisible="True">
Shell
类来设置
<Shell
x:Class="MauiTest.AppShell"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:MauiTest"
BackgroundColor="AliceBlue"
Shell.FlyoutBehavior="Flyout">