This article from http://blog.csdn.net/chenshaoyang0011
One feature of the Android system is its desktop notification system, unlike the desktop management of iOS, which has a desktop system for managing and displaying apps and desktop widgets.
Android provides a default desktop for use, and of course we can also use third-party desktop apps. Android's launcher source code is in \packages\apps\launcher2.
Launcher2 's main layout file includes Res\layout-land\launcher.xml
, Res\layout-port\launcher.xml, Res\layout-sw600dp\launcher.xml, respectively, suitable for horizontal screen, vertical screen and 7-inch tablet. The content is similar, here is the example of Res\layout-port\launcher.xml.
First let's look at the structure in Launcher.xml:
- <Com.android.launcher2.DragLayer
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:launcher="Http://schemas.android.com/apk/res/com.android.launcher"
- android:id="@+id/drag_layer"
- ...
- >
- <!--Keep These behind the workspace so, they is not visible when
- We go into AllApps-->
- <include
- android:id="@+id/dock_divider"
- layout="@layout/workspace_divider"
- ...
- />
- <!--Paging indicator --
- <include
- android:id="@+id/paged_view_indicator"
- layout="@layout/scroll_indicator"
- ...
- />
- <!--the workspace contains 5 screens of cells --
- <com.android.launcher2.Workspace
- android:id="@+id/workspace"
- ...
- >
- <!--Five split screen, default display Cell3--
- <include android:id= "@+id/cell1" layout="@layout/workspace_screen" />
- <include android:id= "@+id/cell2" layout="@layout/workspace_screen" />
- <include android:id= "@+id/cell3" layout="@layout/workspace_screen" />
- <include android:id= "@+id/cell4" layout="@layout/workspace_screen" />
- <include android:id= "@+id/cell5" layout="@layout/workspace_screen" />
- </com.android.launcher2.Workspace>
- <!--search box/delete box --
- <include
- android:id="@+id/qsb_bar"
- layout="@layout/qsb_bar" />
- <!--Displays the full app interface, including apps, wighets tab tags, and pages that show all apps and real-world apps wighets-
- <include layout="@layout/apps_customize_pane"
- android:id="@+id/apps_customize_pane"
- ..
- />
- <!--workspace The bottom five quick locations--
- <include layout="@layout/hotseat"
- android:id="@+id/hotseat"
- ..
- />
- <!--just started when the Guide page is displayed- -
- <include layout="@layout/workspace_cling"
- android:id="@+id/workspace_cling"
- ...
- />
- <!--is the guide page that appears after the first time you've entered all apps--
- <include layout="@layout/folder_cling"
- android:id="@+id/folder_cling"
- ...
- />
- </com.android.launcher2.DragLayer>
And then we come to one by one. Recognize each of the view controls.
1, the outermost draglayer, is an inherited from the Framlayout view control, displays the entire desktop root container. All the controls on the desktop are in Draglayer.
2, Id/dock_divider, using the layout workspace_divider, is actually a imageview. is the dividing line between workspace and hotseat.
3, Id/paged_view_indicator, using the layout scroll_indicator, the display effect is displayed on the Id/dock_divider a light blue horizontal line, to indicate when the split screen location
4, Id/workspace, working space has five workspace_screen, that is five sub-screen, each sub-screen can be placed shortcut and appwidget, the effect is as follows:
5, Id/cell1. CELL5, representing five sub-screens respectively
6, Id/qsb_bar search box/delete box, switch as needed
7, Id/apps_customize_pane, the effect is as follows
8, Id/hotseat is the main screen below the five quick locations
9. id/workspace_cling When you run Launcher2 for the first time, the animation that will be displayed for guidance is not displayed later
10, Id/folder_cling, the first time to use folder, display to the user's Guide screen.
In this way, we have the ability to have each UI interface and component in the same seat, which makes the next analysis clearer.
Android 4.0 LAUNCHER2 Source Analysis-Main layout file (GO)