【问题标题】:Window Phone8:Black screen after splash screenWindow Phone8:闪屏后黑屏
【发布时间】:2015-01-14 13:33:26
【问题描述】:

我已经面对这个问题很长时间了。问题是我的应用程序加载 SplashScreenImage.jpg 后出现黑屏。黑屏保持 4 到 5 秒,然后我的应用程序加载登录页面.

我尝试使用一些插件进行启动画面 也使用了插件的navigator.splashscreen.show()hide 方法,但是都没有成功。

【问题讨论】:

标签: cordova windows-phone-8 phonegap-plugins cordova-3 cordova-plugins


【解决方案1】:

我确实搜索了两天多来解决这个黑屏问题。 最后,在没有从网上得到任何适当的解决方案后,我决定深入研究并解决它。

这就是解决办法

只需将以下行添加到您的 MainPage.xaml

    <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="yoursplashimage.jpg"/>

所以现在您的 MainPage.xaml 应该如下所示

<phone:PhoneApplicationPage 
x:Class="yourappsnamespace.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
Background="Black"
SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
shell:SystemTray.IsVisible="True" d:DesignHeight="768" d:DesignWidth="480" 
xmlns:my="clr-namespace:WPCordovaClassLib">
<Grid x:Name="LayoutRoot" Background="Transparent" HorizontalAlignment="Stretch">
    <Grid.RowDefinitions>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
    <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="yoursplashimage.jpg"/>
    <my:CordovaView HorizontalAlignment="Stretch" 
               Margin="0,0,0,0"  
               x:Name="CordovaView" 
               VerticalAlignment="Stretch" />
</Grid>

</phone:PhoneApplicationPage>

就是这样。现在您将摆脱愚蠢的黑屏。 还有一件事就是从根文件夹中删除 SplashScreenImage.jpg 以避免图像闪烁(注意:如果不删除 SplashScreenImage.jpg 则可以,这取决于一次选择)

【讨论】:

    【解决方案2】:

    我认为您无法删除或减少在Splashscreen 之后出现的黑屏时间。 但是您可以尝试使您的应用程序更快,理想情况下可以更快地加载您的应用程序。 Ways to Load Applications Faster

    参考:How to make a windows phone application load faster like default applications?

    【讨论】:

    • 嗨,实际上我尝试了你的方法,但它不起作用。必须有一些简单的方法。你能帮我解决其他问题吗
    【解决方案3】:

    如果您仅将 SplashScreen 用于品牌推广,您可以执行以下操作。

    创建一个新页面。

    将 SplashScreen Image 设置为该页面的背景图片。

    在加载事件上,比如 LayoutRoot 加载事件,添加一些延迟

    延迟时间结束后导航到您的主页。

    代码有点像:-

        using System.Threading.Tasks;  //add the namespace
        private async void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            await Task.Delay(4000);   //add the delay
            NavigationService.Navigate(new Uri("/StartingPage.xaml"));  //navigate to your starting page
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-05
      • 2018-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多