1

In order to remove the default white splash screen I made a custom theme:

styles.xml

 <style name="AppTheme.SplashTheme">
        <item name="android:windowBackground">@drawable/splash_screen</item>
  </style>

splash_screen.xml

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
android:opacity="opaque">

<!--<item android:drawable="?colorPrimary" />-->
<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/wq_logo" />
</item>
</layer-list>

Everything works fine but I want to change the background color of it. Its currently showing a purple color background. I want to make it white. In this app I'm using a Navigation drawer layout.

kelalaka
  • 5,064
  • 5
  • 27
  • 44
Im Batman
  • 1,842
  • 1
  • 31
  • 48
  • You don't have to apply a separate Theme for the Splash Activity, do you? Just change the background color of the xml file of the Activity would do. – vidulaJ Oct 07 '16 at 05:29
  • @vidulaJ in default android shows whitescreen while loading the app. i wanted to remove it and show logo in middle. this is the easiest method i found. and its working fine. – Im Batman Oct 07 '16 at 05:31
  • Yeah, got your point. Good to know it's working! – vidulaJ Oct 07 '16 at 05:47

2 Answers2

8

Change the splash_screen.xml like this

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
         android:opacity="opaque">

<item>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"      
       android:shape="rectangle">
      <solid android:color="@color/grey" />
    </shape>
</item>
<item>
    <bitmap
        android:gravity="center"
        android:src="@drawable/wq_logo" />
</item>

You can add another item to the layer-list. You only have to change the background color to your preferred one.

Kaiser
  • 606
  • 8
  • 22
Harshad Pansuriya
  • 20,189
  • 8
  • 67
  • 95
1

For my part, this solution did not solve the problem. To fix it I declare the background image of the splash screen like this: (dont use bitmap)

<item android:drawable="@color/colorPrimary" />

<item
    android:drawable="@drawable/ic_launcher"
    android:gravity="center" />
Jack.N
  • 11
  • 1