Solutions to black screen during Android activity switching (jump)

When two activities jump, because the second activity loads more data during startup, there will be a short black screen time before startup. A simple way to solve this problem is to set the theme of the second activity to be transparent, so that the black screen when starting the second activity becomes the first activity interface. This is completed in two steps: Step 1: add the theme of the custom activity in XXX / RES / values / styles.xml, as shown below:

[html] <style name="Transparent" parent="android:Theme.Light"> <!-- Set the theme of the activity to transparent -- > < item name = "Android: windowsistranslucent" > true < / item > < / style >

<style name="Transparent" parent="android:Theme.Light"> <!-- Set the theme of the activity to transparent -- > < item name = "Android: windowsistranslucent" > true < / item > < / style > Step 2: set the "Android: theme" attribute of the second activity to the theme style just customized in androidmanifest.xml. As follows:

[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 annoying black screen here.

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
分享
二维码
< <上一篇
下一篇>>