How to remove gray screen before splash screen – Ionic 4

Issue

Has someone managed to remove the gray screen when launching an ionic app from an android device?
Is there a way to remove this annoying gray screen?

Solution

I found a solution it’s working fine for me using 5 steps.

1.) Create a file name colors.xml inside project\platforms\android\app\src\main\res\values

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="gray">#fff</color>
    <color name="black">#fff</color>
</resources>

2.) Then create a new file styles.xml inside project\platforms\android\app\src\main\res\values

<resources>
  <style name="SplashTheme" parent="@android:style/Theme.DeviceDefault.NoActionBar">
    <item name="android:windowBackground">@drawable/background_splash</item>
  </style>
</resources>

3.) Then open AndroidManifest.xml from project\platforms\android\app\src\main, then search android:theme="@android:style/Theme.DeviceDefault.NoActionBar" and replace with android:theme="@style/SplashTheme"

4.) Create a folder name drawable inside project\platforms\android\app\src\main\res

5.) Inside drawable folder create a new file having name background_splash.xml and the code is below.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">    
    <item android:drawable="@color/black"/>   
</layer-list>

That’s all.
Hope its help.

Answered By – Abhay Singh

Answer Checked By – Pedro (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.