Android activity switch (jump) when a black screen solution to share _android

Source: Internet
Author: User

In the two activity jumps, as the second activity loads more data at startup, a short black screen time appears before it starts, and the easiest way to deal with this problem is to set the subject of the second activity to Transparent, So the black screen at the start of the second activity becomes the display of the first activity interface. This is done in two steps:
Step one: Add the theme of the custom activity in Xxx/res/values/styles.xml, as follows:

[HTML] <style name= "Transparent" parent= "Android:Theme.Light" >
<!--set the theme of activity to transparent-->
<item name= "Android:windowistranslucent" >true</item>
</style>

<style name= "Transparent" parent= "Android:Theme.Light" >
<!--set the theme of activity to transparent-->
<item name= "Android:windowistranslucent" >true</item>
</style> Step Two: In Androidmanifest.xml, set the "Android:theme" property of the second activity to the theme style that you just customized. As shown below:

[HTML] <activity
Android:name= "Com.yutao.customer.CustomerActivity"
Android:label= "@string/app_name"
Android:theme= "@style/transparent" >

<activity
Android:name= "Com.yutao.customer.CustomerActivity"
Android:label= "@string/app_name"
Android:theme= "@style/transparent" > There should be no such a nasty black screen.

Related Article

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.