Analysis of Android 4.0 ICS systemui -- statusbar Structure

Source: Internet
Author: User

In the previous article "android
4.0 ICS systemui analysis-systemui Startup Process and the composition of systemui. This article mainly analyzes the statusbar structure.

1. layout Overview

First, we can use the hierarchyviewer tool to view the layout after the system is started (Note: hierarchyviewer runs hierarchyviewer In the SDK/tools directory in windows. bat is executed by the terminal in Linux. /hierarchyviewer; after installing the ADT plug-in, you can also use eclipse to call hierarchyviewer ). 1.1:

Fig 1.1

Here is a brief introduction to the components on the current interface, which is used to unlock the interface after the simulator is started. It contains seven components: recentspanel, satusbar, statusbarexpanded, trackingview, keyguard, and COM. android. launcher/COM. android. launcher2.launcher, Com. android. systemui. imagewallpaper.

Recentspanel: refers to the "recently run program" that is popped up by pressing the Home Key ". 1.2:

Fig 1.2

Satusbar: This is our main character-status bar. Since it was just started, no notification application is running, such as 1.3:


Fig 1.3

Statusbarexpanded: we already know the literal meaning, which is actually the Extended Interface when the notification bar is pulled down. 1.4:


Fig 1.4

Note: Because the simulator cannot display the current USB connection status, use a real machine here.

Trackingview: it refers to the place except statusbarexpanded after we pull down the notification bar. 1.5:


Fig 1.5

Keyguard: This is the screen lock, because it has been unlocked, so no layout is visible.

Com. Android. launcher/COM. Android. launcher2.launcher: Our launcher, 1.6:


Fig 1.6

Com. Android. systemui. imagewallpaper: The wallpaper is set by imagewallpaper in systemui.

2. Ding jieniu of statusbar

According to the overall description above, I believe that you have an overall concept of the android 4.0 interface. Next we will go into the topic-statusbar structure analysis. The statusbar analysis starts from the following two aspects: first, the interface analysis. Observe the layout structure of statusbar through hierarchyviewer. Secondly, analyze the specific implementation of each component through code (Note: This article mainly analyzes the structure of each component from the interface ).

I thought I would use a real machine for demonstration later. Therefore, the statusbar structure diagram of the real machine and the native statubar structure diagram are pasted here for comparison. The real machine uses the Qualcomm dual-card platform and is modified based on the native. The native statusbar structure is 2.1, and the real machine statusbar structure is 2.2:


Fig 2.1


Figure 2.2 (if you cannot see it clearly, click here to download all the images)

The statusbar structure is clearly listed in Figures 2.1 and 2.2. statusbar is actually composed of phonestatusbarview, and phonestatusbarview is subdivided into two major modules: icons and ticker. We know that under normal circumstances, the notification icon (notificationicons), The statusicons, And the signal_battery_cluster are placed on the left of the system, and the clock on the right ), ticker is invisible by default, so the statusbar we actually see is the icons layout. The following describes the structure of these independent modules.

I used different backgrounds for components of statusbar (icationicationicons, statusicons, signal_battery_cluster, clock, and ticker), so that the relationships between different la s can be clearly and intuitively seen (note: I am using Qualcomm's dual-card platform ). 2.3 and 2.4:


Fig 2.3


Fig 2.4

In Figure 2.3 and Figure 2.4, the meanings of each color are as follows:

RED: icationicationicons, notification icons, such as our common 360 and QQ, will display their own icons here;

Purple: statusicons, status icon. Some status icons of the system are placed here, such as Bluetooth, alarm clock, and earphone insertion;

Green: signal_battery_cluster, signal and power icon. Wi-Fi, mobile phone signal, and battery icons are mainly placed here (Note: No SIM card is inserted );

Yellow: clock, clock icon;

Blue: ticker, notification information icon. After the system receives the notification, some notifications have notification information, so they will be displayed through ticker, such as disabling the floating window of 360 and plugging the SD card;

Sacrifice our hierarchyviewer again to view the composition of each part.

Icationicationicons layout: 2.5:


Fig 2.5

Here is a little different from Android 4.0 native, because there are some changes similar to Android 2.3, but the overall is similar. The four statusbariconviews correspond to the four icons in the figure, which are integrated and displayed through iconmerger, that is, nocificationicons.

The statusicons layout is shown in Figure 2.6:


Fig 2.6

As shown in Figure 2.6, statusicons is a linearlayout containing eight statusbariconviews. Each statusbariconview stores different system icons, such as Bluetooth, headset insertion, and alarm clocks.

The layout of signal_battery_cluster is shown in Figure 2.7:


Fig 2.7

From Figure 2.7, we can see that this is a complicated piece of structure, because Qualcomm uses dual-Card Compared with native Android 4.0, so we made some modifications here.

Clock layout 2.8 is shown in the following figure:


Fig 2.8

Here we only read a clock layout. In fact, clock inherits from textview, which will be mentioned later in code analysis.

Finally, let's take a look at the layout structure of ticker, 2.9:


Fig 2.9

As shown in Figure 2.9, ticker consists of tickerview and imageswitcher, while imageswitcher consists of two custom imageviews. tickerview is actually a combination of two textviews.

3. Summary of statusbar Structure Analysis

The statusbar of Android 4.0 is relatively large compared with Android 2.3. The statusbar analysis is conducive to the customization of statusbar, for more information about the functions of each module, you can gain a deeper understanding of the Android system. For this structure analysis, I am more familiar with the use of hierarchyviewer and have a deeper understanding of statusbar in the whole systemui.

In the future, we will continue to analyze the loading and workflow of statusbar in Android 4.0 from the code direction. Stay tuned

Related Article

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.