我为我的 Windows uWP 应用程序构建了一个扩展的启动屏幕。我按照此页面中的示例代码(包括用于扩展启动屏幕的 xaml)进行操作
显示启动画面以延长时间 https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-a-customized-splash-screen
它在桌面窗口上正确渲染,它完美居中并与初始启动屏幕图像完全对齐,但是当我尝试移动模拟器时(我尝试了 720p 的 5 英寸屏幕之一),扩展启动屏幕页面图像似乎太大(它看起来几乎大两倍或三倍),并且出现在页面右下角被切断的情况,我假设进度环位于图像下方并且超出页面边界,因此不可见。
这是它在移动设备上的样子,左图是初始启动屏幕,右图是扩展的启动页面。
我的扩展启动页面的 XAML 是这样的
<Page
x:Class="MyApp_Win10.ExtendedSplash"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:MyApp_Win10"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="#FF000012" >
<Canvas>
<Image x:Name="extendedSplashImage" Source="Assets/SplashScreen/SplashScreenImage3.png"/>
<ProgressRing Name="splashProgressRing" IsActive="True" Width="60" Height="60" HorizontalAlignment="Center"></ProgressRing>
</Canvas>
</Grid>
</Page>
我的 package.appmanifest 看起来像这样。 (Assets 文件夹中有一张图像被创建为 Splash Screen Image.scale-200.png,尺寸为 1240(宽)x 600(高))
EDIT:我将剩余的 3 个图像比例 150、125 和 100 添加到 package.appmanifest 中,但没有任何区别。由于扩展的启动页面与初始启动页面不同,我认为它正在选择我在 XAML 中编写的确切图像文件 - 这是尺寸为 1240 w x 600 h 的完整尺寸。
同样在扩展启动画面的代码隐藏中,这些是启动画面的坐标
EDIT:我的 PositionImage() 和 PositionRing() 函数
void PositionImage()
{
extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.X);
extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Y);
extendedSplashImage.Height = splashImageRect.Height;
extendedSplashImage.Width = splashImageRect.Width;
}
void PositionRing()
{
splashProgressRing.SetValue(Canvas.LeftProperty, splashImageRect.X + (splashImageRect.Width * 0.5) - (splashProgressRing.Width * 0.5));
splashProgressRing.SetValue(Canvas.TopProperty, (splashImageRect.Y + splashImageRect.Height + splashImageRect.Height * 0.1));
}