xaml – Windows UWP扩展的初始屏幕图像在移动设备上呈现错误
我为我的
windows uwp应用程序构建了一个扩展的启动画面.我从这个页面跟随示例代码,包括xaml for extended spash screen
Display a splash screen for more time 它在桌面窗口上正确呈现,它完全居中并与初始的闪屏图像完全对齐,但是当我尝试移动模拟器时,(我在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 forlder中有一个图像创建为SplashScreenImage3.scale-200.png,尺寸为1240 x x 600 h) 编辑:我将剩余的3个图像比例150,125和100添加到package.appmanifest但它没有任何区别.由于扩展的启动页面与初始启动页面不同,我认为它选择了我在XAML中编写的确切图像文件 – 这是尺寸为1240 x x 600 h的完整尺寸. 此外,在扩展启动的代码隐藏中,这些是启动画面的坐标 编辑:我的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)); } 解决方法
确保在您的PositionImage()和PositionRing()函数中,当设备是手机时,您可以按如下方式处理案例
void PositionImage() { extendedSplashImage.SetValue(Canvas.LeftProperty,splashImageRect.Y); if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { extendedSplashImage.Height = splashImageRect.Height / ScaleFactor; extendedSplashImage.Width = splashImageRect.Width / ScaleFactor; } else { extendedSplashImage.Height = splashImageRect.Height; extendedSplashImage.Width = splashImageRect.Width; } } void PositionRing() { splashProgressRing.SetValue(Canvas.LeftProperty,(splashImageRect.Y + splashImageRect.Height + splashImageRect.Height * 0.1)); if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons")) { splashProgressRing.Height = splashProgressRing.Height / ScaleFactor; splashProgressRing.Width = splashProgressRing.Width / ScaleFactor; } } 和 //Variable to hold the device scale factor (use to determine phone screen resolution) private double ScaleFactor = DisplayInformation.GetForCurrentView().RawPixelsPerViewPixel; (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- windows-7 – 如何在Windows 7中使用PowerShell或命令行打开
- Windows Phone 7 – WP7警报对话框
- Windows上的SQLite数据库是否有MySQLAdmin或SQL Server Man
- 在Windows的粘滞便笺中滚动鼠标
- windows – 按文件名前缀顺序读取目录中的文件?
- Gnuwin32 find.exe在执行搜索之前扩展通配符
- Windows Server 2008 R2和2012中PHP连接MySQL过慢的解决方法
- windows – 使用加密密码创建服务
- windows-server-2008 – whenChanged Active Directory属性
- 缓存 – 有没有办法在Microsoft Enterprise Library中创建多