Detailed explanation of the source code launcher Main Screen Program Arrangement in Android [Android launcher evolution 1]

Source: Internet
Author: User
Tags home screen

Recently I have studied lancher, from the text message MMS framework to the bug and demand modification of launcher. Next I will explain the layout of the simplest home screen program of launcher, it gives readers a sense of getting started. The main screen of Android is divided into five screens, which are 0, 1, 2, 3, and 4 from left to right. So which programs or widgets you want to put on the home screen can be implemented in the layout file. Next I will talk about the layout file default_workspace.xml. This is a layout file for the main screen arrangement. It is written here. After the program is run, you can implement the specific programs or widgets on the screen. Let's first take a look at figure (1) and figure (2 ). Figure (1) shows a three-screen layout for the master screen, with the shortcut of four programs at the bottom. Figure (2) shows me a rough picture. The screen is generally divided into two-dimensional coordinates, with the origin () in the upper left corner ), the horizontal direction is the X axis (the coordinates are 1 to the right, respectively, 0, 1, 2, 3), and the vertical is the Y axis (1 to the downward direction, respectively, 0, 1, 2, 3 ). Daming Original: For reprinted, please indicate the source: http://blog.csdn.net/wdaming1986/article/details/6978814. First, let's look at the code in the layout file:

 


Figure (1) figure (2)


The code in the layout file is as follows:

[HTML]
View plaincopyprint?
  1. <? XML version = "1.0" encoding = "UTF-8"?>
  2. <! -- Copyright (c) 2009 the android open source project
  3. Licensed under the Apache license, version 2.0 (the "License ");
  4. You may not use this file before t in compliance with the license.
  5. You may obtain a copy of the license
  6. Http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. Distributed under the license is distributed on an "as is" basis,
  9. Without warranties or conditions of any kind, either express or implied.
  10. See the license for the specific language governing permissions and
  11. Limitations under the license.
  12. -->
  13. <Favorites xmlns: launcher = "http://schemas.android.com/apk/res/com.android.launcher">
  14. <! -- Far-left screen [0] -->
  15. <! -- Left screen [1] -->
  16. <Appwidget
  17. Launcher: packagename = "com. Google. Android. Apps. Genie. geniewidget"
  18. Launcher: classname = "com. Google. Android. Apps. Genie. geniewidget. miniwidget. miniwidgetprovider"
  19. Launcher: screen = "1"
  20. Launcher: x = "0"
  21. Launcher: Y = "0"
  22. Launcher: Spanx = "4"
  23. Launcher: spany = "1"/>
  24. <! -- Middle screen [2] -->
  25. <Search
  26. Launcher: screen = "2"
  27. Launcher: x = "0"
  28. Launcher: Y = "0"/>
  29. <Appwidget
  30. Launcher: packagename = "com. Android. protips"
  31. Launcher: classname = "com. Android. protips. protipwidget"
  32. Launcher: screen = "2"
  33. Launcher: x = "0"
  34. Launcher: Y = "1"
  35. Launcher: Spanx = "4"
  36. Launcher: spany = "1"/>
  37. <Favorite
  38. Launcher: packagename = "com. Android. MMS"
  39. Launcher: classname = "com. Android. mms. mainactivity"
  40. Launcher: screen = "2"
  41. Launcher: x = "0"
  42. Launcher: Y = "3"
  43. />
  44. <Favorite
  45. Launcher: packagename = "com. Android. Phone"
  46. Launcher: classname = "com. Android. Phone. mainactivity"
  47. Launcher: screen = "2"
  48. Launcher: x = "1"
  49. Launcher: Y = "3"
  50. />
  51. <Favorite
  52. Launcher: packagename = "com. Android. Email"
  53. Launcher: classname = "com. Android. Email. mainactivity"
  54. Launcher: screen = "2"
  55. Launcher: x = "2"
  56. Launcher: Y = "3"
  57. />
  58. <Favorite
  59. Launcher: packagename = "com. Android. yuemei"
  60. Launcher: classname = "com. Android. yuemei. mainactivity"
  61. Launcher: screen = "2"
  62. Launcher: x = "3"
  63. Launcher: Y = "3"
  64. />
  65. <! -- Right screen [3] -->
  66. <Appwidget
  67. Launcher: packagename = "com. Android. Music"
  68. Launcher: classname = "com. Android. Music. mediaappwidgetprovider"
  69. Launcher: screen = "3"
  70. Launcher: x = "0"
  71. Launcher: Y = "0"
  72. Launcher: Spanx = "4"
  73. Launcher: spany = "1"/>
  74. <Appwidget
  75. Launcher: packagename = "com. Android. Vending"
  76. Launcher: classname = "com. Android. Vending. marketwidgetprovider"
  77. Launcher: screen = "3"
  78. Launcher: x = "1"
  79. Launcher: Y = "1"
  80. Launcher: Spanx = "2"
  81. Launcher: spany = "2"/>
  82. <! -- Far-right screen [4] -->
  83. </Favorites>

Label description:

<Appwidget> Add corresponding widgets;

<Search> Add a Google search box;

<Favorite> shortcut for adding programs;

Attribute description:


Launcher: packagename = "com. Android. Vending" program package name.

Launcher: classname = "com. Android. Vending. marketwidgetprovider" Name of the program entry class.

Launcher: screen = "3" indicates the position of the screen, which is: 0, 1, 2, 3, 4. A total of 5 screens, 2nd screens as the main screen.

Launcher: the position of X = "1" on the X axis. Add four numbers to the right, respectively, 0, 1, 2, and 3.

Launcher: the position of Y = "1" on the Y axis, which is drawn by (2. The numbers are increased sequentially, respectively, 0, 1, 2, and 3. in total.

Launcher: number of cells that spanx = "4" occupies on the X axis. "4" represents 4 cells.

Launcher: number of cells that spany = "2" occupies on the Y axis. "2" indicates 2.

 

Daming Original: Reprint please indicate the source: http://blog.csdn.net/wdaming1986/article/details/6978814

 

Compilation instructions:


(1) build first. If you have any questions, refer to compiling the source code for Android in Linux [Android Evolution ];

(2) After mm is complete, push it to the mobile phone:

ADB push.../../out/target/product/n80w/system/APP/launcher.apk system/APP/

(3) Go to the red screen of the phone. Press the START key and the volume reduction key together.

(4) use the root permission to enter the ../out/host/linux_x86/bin/directory and enter the command:

#./Fastboot-W clear userdata and cache. Purpose: Make sure you have the desired effect!

(5) restart the phone at last: or enter the command:./fastboot reboot.

Or simply click the button to restart the battery. I declare in advance that I am not responsible for any problems with the mobile phone during the operation.

In this way, the expected results are displayed.

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.