SoFunction
Updated on 2025-03-11

Solution to the problem of starting a white screen in Android

The project started for a while not long ago. At first, I suspected that it was caused by the newly added Instant Run function in Android Studio. So after re-installing the release package, I found that there was still such a problem. Suddenly, I integrated Yunxin into the last time. So I guessed that it might be caused by the initialization operation in the Application after joining Yunxin, and some initialization time-consuming operations of the HomeActivity main interface. So we found a way to eliminate the white screen. There are two solutions to see:

1. Add such item to the interface theme style of the startup Activity

 <style name="" parent="">
  <item name="android:windowFullscreen">true</item>
  <item name="android:windowBackground">@drawable/splash</item>
 </style>

Create splash in the drawable directory

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:andro>
 <item>
  <bitmap
   android:
   android:src="@mipmap/bg_welcome">
  </bitmap>
 </item>
</layer-list>

Customize this background image into your own startup image.

2. Add directly to style

 <style name="" parent="">

  <item name="android:windowIsTranslucent">true</item>
  <item name="android:windowNoTitle">true</item>

</style>

Setting both properties to true can make the program transparent when initializing, and the main interface of the program will be displayed after initialization, so that the white screen interface will be completely invisible.

Basically, there are two solutions above. The first solution can be quickly released after clicking on the application startup interface, but it takes a while for the user to enter. The second solution will start by clicking on the icon on the desktop and will wait for a while before splash appears, and will not come out after the application is initialized. The two have their own advantages. Which one is used depends on your needs. I recommend using the first one, which has a better user experience.

The above is all the content of this article. I hope it will be helpful to everyone's study and I hope everyone will support me more.