Method for solving white screen problem during cold start of Android Application

When an Android application is cold started, it needs to start from the application, and the loading time will be relatively long. It is easy to have a white or black flashing screen. This phenomenon does not exist in some other apps on the mobile phone, such as wechat and JD.

Cause analysis

The reason is actually related to the theme of the flash screen activity. For example, if the theme.appcompat.light.darkactionbar theme is used, the windowbackground is specified, so the background is white.

Solution

Set theme

We need to specify the theme of splashactivity in the manifest

Set style background picture

This style is only used as the theme of the flash screen. The default theme of app still uses apptheme

After this setting, the built-in flash screen image of app will appear by default, then the online flash screen will be dynamically loaded in splashactivity, and finally enter the main interface. The final implementation effect is similar to JD's app.

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>