Android Starting Window (Preview Window)

Source: Internet
Author: User

When an Activity is opened, if the application to which the Activity belongs is not running, the system will create a process for the application to which the Activity belongs, but it takes time to create and initialize the process, what should the system do before this operation is completed? If there is no response, if the initialization time of the program is long, the user may think that there is no point in the corresponding position. But at this time, the started program has not been initialized, so it cannot be displayed, nor can it be stopped in the original place without any action. What should I do? This will happen.Starting WindowCan also be calledPreview Window.

Starting Window is a temporary Window used to display before the application process is created and initialized successfully.APPLICATIONSTARTING. This window is displayed before the program Initialization is complete to inform the user system that he wants to open the application and make a response. After the program Initialization is complete, the user UI is displayed and the window is removed.

We have seen this Starting Window, but we may not have noticed it. It is actually the black screen Window when the program is enabled, Which is ugly enough. However, there is no way. The interface of each program is not the same. The system only displays a very simple window by default.

If the so-called Starting Window is just a black screen Window, this function is too weak. In fact, the system can display different Theme values based on each program.

When we started the application, although our program was not initialized, the components in the program were registered by system analysis during the installation of the program. We can set different Theme for each Application and Activity. The system initializes Starting Window Based on this Theme. The top layer of the Window layout is DecorView, and the Starting Window is the DecorView that displays an empty Theme that is applied to the Activity (Application is used if the Activity is not specified.

In Theme, you can specify many Theme items, such as the ActionBar style, window background, and Activity icon. By specifying Theme for the Activity, the system can apply the Theme to the Starting Window before the initialization of our application is complete. It looks like our application has been started, but the data content has not been initialized yet.

Therefore, if the Background of your Activity is a simple solid color, you 'd better apply Theme to the Background of the Activity instead of setting it as the Background of Layout on the top, if you really need to set the background for the top-level Layout, you can alsoAndroid: windowBackgroundSet a background similar to the Activity UI. To prevent OverdrawOnCreatePassedSetWindowBackground ()Set the background of the windowNull.

The system displays a Starting Window before displaying the Activity only when you need to create a process for Starting the Activity, generally, it is the entry Activity of an application (including the Activity in which the icon shown in Lanuncher enters and the Activity called by other applications ).

There is also a situation where there are multiple processes in the application (throughAndroid: process). For example, your program needs to use a separate process to view images. When the main process of your application enters the Activity of Image Browsing, the system will create a process for Image Browsing, if the icons required by the Activity to be browsed by images are different from those specified by the Application, you should pay attention to them, when the system displays the Starting Window of an Activity in the Image Process, the Activity will not use the icon specified by android: icon in Manifest, but will only use the icon specified in Theme, if a Theme is not specified for this Activity or android: icon is not specified in the specified Theme, the system uses the android: icon specified by the Application tag, the result is that an icon is displayed in the Starting Window. After the Activity is loaded, the icon changes to the android: icon specified by the Activity in Manifest. There is a change process.

For more information, see Android App Launching Made Gorgeous.

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.