Android 4.0 ICS systemui Analysis of--statusbar structureCategory: Android2012-06-30 14:45 23687 People read Comments (8) favorite reports Androidsignal Code Analysis Iconseclipse Platform
In the previous article "Android 4.0 ICS Systemui Analysis--systemui Start-up process" and mentioned the composition of Systemui, this paper mainly analyzes the statusbar structure.
1. Layout Overview
First, we use the Hierarchyviewer tool to look at the layout of the system after boot (note: Hierarchyviewer in the Sdk/tools directory, In the Windows environment, the terminal executes directly under the Hierarchyviewer.bat,linux environment./hierarchyviewer; After installing the ADT plug-in, you can also call Hierarchyviewer through eclipse to view it. 1.1:
Figure 1.1
Here is a simple introduction to the current interface of the component, the interface for the emulator to unlock the interface after the start. It contains 7 components, from top to bottom, Recentspanel, Satusbar, statusbarexpanded, Trackingview, Keyguard, com.android.launcher/ Com.android.launcher2.Launcher, Com.android.systemui.ImageWallpaper.
Recentspanel: Refers to the "recently run Program" that we press the home button to pop up. 1.2:
Figure 1.2
Satusbar: This is our main character-the status bar. Because it is just started, no notification applications are running, such as 1.3:
Figure 1.3
Statusbarexpanded: According to the literal meaning we already know, this is actually the notification bar drop-down when the extension interface. 1.4:
Figure 1.4
Note: Because the emulator does not actually show the current connection status of the USB, it is replaced with a real machine.
Trackingview: It means that we will drop off the notice bar, except statusbarexpanded. 1.5:
Figure 1.5
Keyguard: This is the screen lock because it is currently unlocked, so no layout is visible.
Com.android.launcher/com.android.launcher2.launcher: That's our launcher,1.6:
Figure 1.6
Com.android.systemui.ImageWallpaper: That is, the wallpaper, is set by the Imagewallpaper in Systemui.
2.StatusBar of discovering
According to the previous overall description, I believe that you have an overall concept of the Android 4.0 interface, then cut into the topic--statusbar structure analysis. The analysis of StatusBar from the following two aspects: first, from the interface analysis. Through the hierarchyviewer to observe the layout structure of StatusBar, secondly, through the code to analyze the specific implementation of each component (note: This article mainly from the interface for structural analysis).
I think I'm going to use the real machine for the demonstration, so I'll put the statusbar structure of the real machine and the native Statubar structure to make a comparison. The real machine uses the Qualcomm dual SIM platform, on the basis of the original modification, the original StatusBar structure 2.1, the real machine StatusBar structure 2.2:
Figure 2.1
Figure 2.2 (see not clear friends can click here to download all the pictures)
Figures 2.1 and 2.2 clearly list the structure of the StatusBar, StatusBar is actually composed of Phonestatusbarview, and Phonestatusbarview is subdivided into two large modules, icons and ticker two layouts respectively. We know that under normal circumstances, the system left place the notification icon (notificationicons), the middle Placement status icon (statusicons) and the Signal icon (signal_battery_cluster), the right place date (clock), Ticker is invisible by default, so actually the statusbar we really see is the icons layout. Here we describe the structure of these independent modules separately.
I use different backgrounds for the components of StatusBar (Notificationicons, statusicons, signal_battery_cluster, clock, ticker), respectively. This gives you a clear and intuitive view of the relationship between the layouts (note: I'm using a high-pass dual-SIM platform). 2.3 and 2.4:
Figure 2.3
Figure 2.4
In Figure 2.3 and figure 2.4, each color represents the following meanings:
Red: notificationicons, notification icons, such as our common 360 and QQ and so on, will show their own icon here;
Purple: statusicons, status icon, here will put some status icons of the system, such as Bluetooth, alarm clock, headphone insertion and so on;
Green: Signal_battery_cluster, signal and battery icon, here is the main place WiFi and cell phone signal and battery power icon (note: No SIM card inserted);
Yellow: clock, clocks icon;
Blue: Ticker, notification information icon, when the system received notification, some notifications have notification information, so it will be displayed through ticker, such as disabling 360 of the suspended window, Plug and unplug SD card, etc.;
Once again, we hierarchyviewer to see the composition of each part.
Layout of Notificationicons 2.5:
Figure 2.5
This is a little bit different from Android 4.0 native, because there are some changes like Android 2.3, but the whole is pretty much the same. The 4 icons in the 4 Statusbariconview map are integrated and displayed via Iconmerger, which is nocificationicons.
The layout of the statusicons is shown in 2.6:
Figure 2.6
As we can see from Figure 2.6, Statusicons is a linearlayout that contains 8 Statusbariconview, each of which stores different system icons, such as Bluetooth, headphone insertion, alarm clock, and so on.
The layout of the Signal_battery_cluster is shown in 2.7:
Figure 2.7
As we can see from figure 2.7, this piece is a complex piece of structure because Qualcomm uses a dual sim compared to native Android 4.0, so there is a slight modification here.
The clock layout is shown in 2.8:
Figure 2.8
We only see a clock layout here, in fact clock inherits from the TextView, subsequent in the code analysis will be mentioned.
Finally let's look at the layout structure of ticker, 2.9:
Figure 2.9
As you can see in Figure 2.9, ticker consists of Tickerview and Imageswitcher, and Imageswitcher is composed of two custom ImageView, Tickerview is actually a combination of two textview.
Summary of 3.StatusBar structural analysis
Android 4.0 StatusBar relative to the Android 2.3 is still relatively large, for statusbar analysis, for StatusBar personalized, detailed understanding of the functions of each module can be more in-depth understanding of the Android system. For this structure analysis, more familiar with the use of hierarchyviewer, for the whole systemui in the StatusBar also have a deeper understanding.
Subsequent analysis will continue to analyze the loading and workflow of StatusBar in Android 4.0 from the direction of the code. Please follow
Android 4.0 ICS systemui Analysis of--statusbar structure