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