Android uses theme to solve a blank screen problem when you start the app _android

Source: Internet
Author: User

It is believed that most people start with a white or black screen before starting the app and then entering the first interface, for example: Splashactivity. Then what is the cause of it?

<style name= "Splash_theme" parent= "@android: Style/theme.notitlebar" >
</style>

The reason is that we have to change the theme of activity/application set cause, because the theme of the corresponding Windowbackground and other backgrounds are set to white or black, And when we enter the first interface of the app, we don't execute oncreate right away, so it screen or black screen before entering the interface.

So I tried to search for a delayed start to solve the problem. But the egg, after I decompile the micro-letter and so some of the not-so-effective app view their theme settings, and found the solution:

1. Setting up a background similar to the background of the startup page, if your startup page is a picture then you can set the picture directly to windowbackground this property so there's no flash effect.

<!--setting Theme background-->
<style name= "Splash_theme" parent= "@android: Style/theme.notitlebar" >
< Item Name= "Android:windowbackground" > @drawable/splash_bg</item>
<item name= "Android: Windownotitle ">true</item>
</style>

2. The use of the way of the environment, set the background is transparent, give a person a sense of delayed start.

<style name= "Splash_theme" parent= "@android: Style/theme.notitlebar" >
<item name= "Android: Windowistranslucent ">true</item>
<item name=" Android:windownotitle ">true</item>
</style>

Take this setting so that we can solve this flash problem and make our application experience a little more perfect.

The above is a small set of Android to introduce the use of theme to solve the launch of the app when the blank screen problem, I hope to help you, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.