White background when Android application starts

Each time my application starts up, a white background appears briefly. Despite using a splash screen, the problem still exists. I would like to set the initial screen to black, instead of white, by default!

This is my splash screen activity:

public class SplashActivity extends Activity { private static String TAG = SplashActivity.class.getName(); private static long SLEEP_TIME = 1; // Sleep for some time @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.requestWindowFeature(Window.FEATURE_NO_TITLE); // Removes title bar setContentView(R.layout.splash); // Start timer and launch main activity IntentLauncher launcher = new IntentLauncher(); launcher.start(); } private class IntentLauncher extends Thread { /** * Sleep for some time and than start new activity. */ @Override public void run() { try { // Sleeping Thread.sleep(SLEEP_TIME*1000); } catch (Exception e) { Log.e(TAG, e.getMessage()); } // Start main activity Intent intent = new Intent(SplashActivity.this, MainActivity.class); SplashActivity.this.startActivity(intent); SplashActivity.this.finish(); } } @Override protected void onPause() { super.onPause(); overridePendingTransition(R.anim.fade_in, R.anim.fade_out); } } 
+8
android android-layout
Nov 02 '13 at 4:12
source share
6 answers

Use this tag in the manifest:

 android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 

instead:

 this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
+7
Nov 02 '13 at 4:19
source share

in styles.xml, in the theme specified in your AndroidManifest.xml, add the following line:

 <item name="android:windowBackground">@android:color/black</item> 
+19
Jan 16 '16 at 12:00
source share

If you want to change the white screen that appears before the screen saver goes black, just change the theme for SplashActivity, and not for the entire application.

You can use this:

 <activity android:name="your.package.SplashActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 

Hope this helps.

+3
Jul 09 '14 at 10:58
source share

You can change the background color of the initial window using a special theme. See Styles and Themes for an example.

+2
Nov 02 '13 at 4:38
source share

You set splash.xml when your activity starts. change this, change the parent background to black or whatever color you wan. it will work or change the theme splash.xml to holo_dark or any other theme

0
Nov 02 '13 at 8:14
source share

in the drawable folder create your own initial_screen.xml file

 <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <!-- black background --> <solid android:color="@color/colorBlack" /> </shape> </item> <!-- launcher icon --> <item android:drawable="@mipmap/ic_launcher_foreground" android:height="150dp" android:width="150dp" android:gravity="center" /> </layer-list> 

then add this to your style

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

Now a black screen with a launch icon will appear every time the application starts

0
Jan 29 '19 at 10:29
source share



All Articles