如何在ionic 2项目中彻底消除空白whitescreen ?

时间:2022-12-17 23:04:45

When the splashscreen finishes loading, the app sometimes go blank and I have to press the home key and open the app again before it works. This happens frequently enough to make it very annoying. Please how can I get rid of it completely. Have seen other solutions but they didn't work for me. Am building for Android.

当splashscreen完成加载时,应用程序有时会空白,我必须按home键并在它运行之前再打开应用程序。这种情况经常发生,使它非常烦人。我怎么才能完全摆脱它呢?我见过其他的解决方案,但它们对我不起作用。构建Android。

1 个解决方案

#1


1  

To avoid the blank screen you can use a theme related to your Activity, for example :

为了避免出现空白屏幕,您可以使用与您的活动相关的主题,例如:

 <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/fondo_splash</item>
   </style>

into the android:windowBackground property you must define a backgroud that will be present all the time, for example an image (stored into @drawable/ )

在android:windowBackground属性中,必须定义一个一直显示的backgroud,例如图像(存储到@drawable/中)

    <item name="android:windowBackground">@drawable/bakg_image_splash</item>

or a color (@color/):

或一个颜色(@color /):

    <item name="android:windowBackground">@color/background_splash</item>

Inside our AndroidManifest.xml we can define the theme for our application :

在我们的AndroidManifest。xml我们可以定义应用程序的主题:

  <application
        android:theme="@style/SplashTheme">

o an specific Activity:

哪一个特定的活动:

<activity android:name=".SplashScreenActivity"
   android:theme="@style/SplashTheme" >

With this we can assure to have a background (drawable or color), and avoid the blank screen.

有了这个,我们可以保证有一个背景(可绘制或颜色),并避免空白屏幕。

如何在ionic 2项目中彻底消除空白whitescreen ?

#1


1  

To avoid the blank screen you can use a theme related to your Activity, for example :

为了避免出现空白屏幕,您可以使用与您的活动相关的主题,例如:

 <style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/fondo_splash</item>
   </style>

into the android:windowBackground property you must define a backgroud that will be present all the time, for example an image (stored into @drawable/ )

在android:windowBackground属性中,必须定义一个一直显示的backgroud,例如图像(存储到@drawable/中)

    <item name="android:windowBackground">@drawable/bakg_image_splash</item>

or a color (@color/):

或一个颜色(@color /):

    <item name="android:windowBackground">@color/background_splash</item>

Inside our AndroidManifest.xml we can define the theme for our application :

在我们的AndroidManifest。xml我们可以定义应用程序的主题:

  <application
        android:theme="@style/SplashTheme">

o an specific Activity:

哪一个特定的活动:

<activity android:name=".SplashScreenActivity"
   android:theme="@style/SplashTheme" >

With this we can assure to have a background (drawable or color), and avoid the blank screen.

有了这个,我们可以保证有一个背景(可绘制或颜色),并避免空白屏幕。

如何在ionic 2项目中彻底消除空白whitescreen ?