Causes and solutions of black or white screen when Android App starts

1. Cause

In fact, it is normal to display a black or white screen, because the window background has been displayed before loading the layout file. A black or white screen is the window background.

Example:

2. Solution

Set style by setting

(1) Set background image theme

By setting a background image. When the program starts, first display this background image to avoid black screen

(2) Set transparent theme

By setting the style to transparent, the whole screen will not be black after the program is started, and will not be displayed at one time until the interface is initialized

Comparison between the two:

Theme1 program starts quickly. The interface first displays the background image, and then refreshes other interface controls. It gives people the feeling of refreshing out of sync. Theme2 gives the impression that the program starts slowly. The interface is brushed out at one time and refreshed synchronously.

(3) Modify androidmanifest xml

Post resolution example:

3. Common theme themes

Android: theme = "@ Android: style / theme. Dialog" / / activity is displayed in dialog mode

Android: theme = "@ Android: style / theme. Notitlebar" / / do not display the application title bar

Android: theme = "@ Android: style / theme. Notitlebar. Fullscreen" / / the application title bar is not displayed and the full screen is displayed

Android: theme = "theme. Light" / / the background is white

Android: theme = "theme. Light. Notitlebar" / / there is no title bar on a white background

Android: theme = "theme. Light. Notitlebar. Fullscreen" / / white background, no title bar, full screen

Android: theme = "theme. Black" / / black background

Android: theme = "theme. Black. Notitlebar" / / there is no title bar on a black background

Android: theme = "theme. Black. Notitlebar. Fullscreen" / / black background, no title bar, full screen

Android: theme = "theme. Wallpaper" / / use the system desktop as the application background

Android: theme = "theme. Wallpaper. Notitlebar" / / use the system desktop as the application background without a title bar

Android: theme = "theme. Wallpaper. Notitlebar. Fullscreen" / / use the system desktop as the application background, no title bar, full screen

Android: theme = "theme. Transparent" / / transparent background

Android: theme = "theme. Transparent. Notitlebar" / / there is no title on the transparent background

Android: theme = "theme. Transparent. Notitlebar. Fullscreen" / / no title on transparent background, full screen

Android: theme = "theme. Panel" / / panel style display

Android: theme = "theme. Light. Panel" / / flat panel style display

The above is to sort out the reasons and solutions for the black or white screen when the android app is started. Continue to supplement relevant materials in the future. Thank you for your support for this site!

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