0

When I launch my app, it blacks out for a fraction of seconds. Then it launches the activity. I would like to make the black out thing to white. Could anyone please help me to change it?

I tried changing the android:windowBackground to white in style xml file. But, it is not not helping out.

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:windowBackground">@color/white</item>
</style>

Thanks in advance!

Sujit Devkar
  • 1,195
  • 3
  • 12
  • 22
  • when you use Theme.AppCompat.Light.DarkActionBar you implicitly set window background to white...try to change white with another color and tell us about result – mohammadreza khalifeh Oct 13 '16 at 18:32

2 Answers2

0

Add in your style:

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

Example to your color.xml file:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#3F51B5</color>
    <color name="colorPrimaryDark">#303F9F</color>
    <color name="colorAccent">#FF4081</color>
    <color name="colorWhite">#ffffff</color>
</resources>

For me, if I change colorWhite to black #000000, my background change for black. If you change to #ffffff (white), your background change for white.

It`s possible bulider any Themes (totaly custom) see: https://developer.android.com/guide/topics/ui/themes.html

manifest file this set correct theme for example:

...
 android:theme="@style/AppTheme">
...

Something this strange, because Light.DarkAction set background in white.

0

This might helps you.

<activity
        android:name="MainActivity"
        android:label="@string/app_name"
        android:theme="@style/splashScreenTheme" >

How do I make a splash screen?

Community
  • 1
  • 1
Rajesh Gopu
  • 863
  • 9
  • 33