Android 4.0 Launcher2 Source Analysis--Main layout file

Source: Internet
Author: User

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:

  1. <Com.android.launcher2.DragLayer
  2. xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:launcher="Http://schemas.android.com/apk/res/com.android.launcher"
  4. android:id="@+id/drag_layer"
  5. ...
  6. >
  7. <!--Keep These behind the workspace so, they is not visible when
  8. We go into AllApps-->
  9. <include
  10. android:id="@+id/dock_divider"
  11. layout="@layout/workspace_divider"
  12. ...
  13. />
  14. <!--Paging indicator --
  15. <include
  16. android:id="@+id/paged_view_indicator"
  17. layout="@layout/scroll_indicator"
  18. ...
  19. />
  20. <!--the workspace contains 5 screens of cells --
  21. <com.android.launcher2.Workspace
  22. android:id="@+id/workspace"
  23. ...
  24. >
  25. <!--Five split screen, default display Cell3--
  26. <include android:id= "@+id/cell1" layout="@layout/workspace_screen" />
  27. <include android:id= "@+id/cell2" layout="@layout/workspace_screen" />
  28. <include android:id= "@+id/cell3" layout="@layout/workspace_screen" />
  29. <include android:id= "@+id/cell4" layout="@layout/workspace_screen" />
  30. <include android:id= "@+id/cell5" layout="@layout/workspace_screen" />
  31. </com.android.launcher2.Workspace>
  32. <!--search box/delete box --
  33. <include
  34. android:id="@+id/qsb_bar"
  35. layout="@layout/qsb_bar" />
  36. <!--Displays the full app interface, including apps, wighets tab tags, and pages that show all apps and real-world apps wighets-
  37. <include layout="@layout/apps_customize_pane"
  38. android:id="@+id/apps_customize_pane"
  39. ..
  40. />
  41. <!--workspace The bottom five quick locations--
  42. <include layout="@layout/hotseat"
  43. android:id="@+id/hotseat"
  44. ..
  45. />
  46. <!--just started when the Guide page is displayed- -
  47. <include layout="@layout/workspace_cling"
  48. android:id="@+id/workspace_cling"
  49. ...
  50. />
  51. <!--is the guide page that appears after the first time you've entered all apps--
  52. <include layout="@layout/folder_cling"
  53. android:id="@+id/folder_cling"
  54. ...
  55. />
  56. </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)

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.