Android starting window (Preview window)

Source: Internet
Author: User

When an activity is opened, if the activity belongs to an application that is not yet running, the system will create a process for the application to which the activity belongs, but the creation and initialization of the process takes time, and what does the system do before the action is completed? If there is no response, the user may think that there is no point to the appropriate location if the program has been initialized for a long time. But at this time the program started has not been initialized, can not display the program, and can not stop in place do not do any action, how to do? This has the concept of starting window , which can also be called the Preview window.

The starting window is a temporary windows that is used to display before the application process is created and initialized successfully, with the window type type_application_starting. This window is displayed before the program is initialized to inform the user that the system already knows that he wants to open the app and responds by displaying the user UI and removing the window when the program is initialized.

We have seen this starting window, but may not have noticed, in fact, the opening process of the black screen of the window, ugly enough. However, there is no way, the interface of each program is not the same, the system only shows a very simple window by default.

If the so-called starting window is just a black screen, then this function is too chicken. In fact, the system can be based on the theme of each program to show a different look.

When launching the application, although our program is not initialized, but the components in the program are installed in the program is the system analysis registered. We can set different theme for each application and activity, and the system initializes the starting window based on this theme. The top level of the window layout is the Decorview,starting window, which displays an empty one, but the decorview with activity-specific theme (application if the activity is not specified) is applied.

In theme, you can specify a lot of things, such as actionbar style, window background, activity icon, etc., by assigning theme to activity, the system can apply this theme to starting before the initialization of our application is complete. Window, so it looks like our app has started up, but the data content hasn't been initialized yet.

So, if your activity background is simply pure color, it is best to apply it directly through theme to the activity's background, instead of setting the background of the top level layout, if you really need to set the background for the top layout, you can also giveandroid:windowBackgroundSet a background similar to the activity UI, in order to prevent overdraw, in the activity'sonCreateThrough thesetWindowBackground()Then set the background of the window tonull

There is also a case where there are multiple processes within the application (via android:process ", for example, your program needs to view the image in a separate process, and when the activity from the main process of your app enters the image viewer, The system will create the process of image browsing, if the image browsing activity needs to use the icon and application specified icon is not the same, it is necessary to note that the system shows the picture process of activity starting window does not use the icon specified by the activity in manifest through Android:icon, but only the icon specified in theme. If you do not specify a theme for this activity or the specified theme does not specify Android:icon, the system uses the Android:icon specified by the application tag, and the result is that you will see starting An icon is displayed in window, and when the activity is loaded, the icon changes to the Android:icon specified in manifest, which has a changing process.

Refer to Android App launching made gorgeous for more information

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.