Teko Luzitu
Teko Luzitu

Reputation: 77

How to remove gray screen before splash screen - Ionic 4

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?

Upvotes: 4

Views: 2561

Answers (3)

Nsamba Isaac
Nsamba Isaac

Reputation: 495

for me i added this code in style.xml file: /Users/User/Development/project/platforms/android/app/src/main/res/values/styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="SplashTheme"  parent="Theme.AppCompat.Light.NoActionBar">
      <item name="android:windowIsTranslucent">true</item>
      <item name="android:windowBackground">@android:color/transparent</item>
      <item name="android:windowContentOverlay">@null</item>
      <item name="android:windowNoTitle">true</item>
      <item name="android:windowIsFloating">false</item>
     <item name="android:backgroundDimEnabled">false</item>
    
</style>
</resources>

and edited my AndroidManifest.xml File : android:theme="@style/SplashTheme" added that to the activity

Upvotes: 1

mani kandan
mani kandan

Reputation: 439

Add

xmlns:android="http://schemas.android.com/apk/res/android"

and

xmlns:cdv="http://cordova.apache.org/ns/1.0"

( if not present) inside you widget tag in you config.xml present in the root of your project.

Then replace android:theme value of your main activity with

@android:style/Theme.Light.NoTitleBar.Fullscreen

Thats it. You need not add any custom styles (If you don't want).

Upvotes: 0

Abhay Singh
Abhay Singh

Reputation: 1689

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.

Upvotes: 5

Related Questions