Analysis of Android 4.0 ICS SystemUI -- StatusBar Structure

Source: Internet
Author: User

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.

Author: yihongyuelan
 

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.