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

Source: Internet
Author: User

When the two activity jumps, as the second activity loads more data at startup, a short black screen time will appear before the start, and a simple way to solve the problem is to set the second activity theme to transparent. This will turn the black screen on the second activity to show the first activity interface. This is done in two steps:
The first step: 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 activity's theme to transparent--
<item name= "Android:windowistranslucent" >true</item>
</style>

<style name= "Transparent" parent= "Android:Theme.Light" >
<!--set the activity's theme to transparent--
<item name= "Android:windowistranslucent" >true</item>
</style> Step Two: Set the second activity's "Android:theme" property in Androidmanifest.xml to the theme style 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.


——————————————————————————————————————————————————————————————————————————

Project Solutions:

Add Style.xml

   <!--Base Application theme. --    <style name= "Apptheme" parent= "Android:Theme.Black.NoTitleBar" >        <!--Customize your Theme Here.        --<item name= "Android:windownotitle" >true</item>        <!--          resolution of the black splash screen. There is another solution: Configure          <item name= "Android:windowistranslucent" >true</item>.          However, the switch animation of the activity is invalidated after the configuration. In this case, you need to configure another parameter,          Windowanimationstyle property. --        <item name= "Android:windowbackground" > @drawable/transparent</item>    </style >


Then use that style in application!



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

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.