.Net Maui 应用程序在 Play Store 时如何解决不同的颜色?

问题描述 投票:0回答:0

我有 .Net 7 Maui 应用程序。

当应用程序从 Visual Studio 部署到物理设备时,顶部栏的颜色设置正确。

然而,当完全相同的项目应用程序发布到 Play 商店时,顶部栏颜色不同。

这是完全相同的项目。

有人知道怎么解决吗?

从 Visual Studio 部署到物理设备的应用程序:正确的颜色

从 Play 商店下载的已发布应用:颜色不正确

这里是如何设置颜色的:

Resources/styles/colors.xml:

<Color x:Key="LightModePageBarColor">#799ff6</Color>

app_shell.xml中

<?xml version="1.0" encoding="UTF-8" ?>
<Shell
    x:Class="MyProject.AppShell"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
    xmlns:local="clr-namespace:MyProject"
    BackgroundColor="{StaticResource LightModePageBarColor}">
    ... shell content
</Shell>

Resources/styles/styles.xml:

<Style TargetType="NavigationPage">
    <Setter Property="BarBackgroundColor" Value="{AppThemeBinding Light={StaticResource LightModePageBarColor}, Dark={StaticResource DarkModePageBarColor}}" />
</Style>
android google-play maui android-styles
© www.soinside.com 2019 - 2024. All rights reserved.