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 (the downward direction is 1, 0, 1, 2, 3 ).. First, let's look at the code in the layout file:
Figure (1) figure (2)
The code in the layout file is as follows:
View plainprint?
<? Xml version = "1.0" encoding = "UTF-8"?>
<! -- Copyright (C) 2009 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License ");
You may not use this file before t in compliance with the License.
You may obtain a copy of the License
Http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
Distributed under the License is distributed on an "as is" BASIS,
Without warranties or conditions of any kind, either express or implied.
See the License for the specific language governing permissions and
Limitations under the License.
-->
<Favorites xmlns: launcher = "http://schemas.android.com/apk/res/com.android.launcher">
<! -- Far-left screen [0] -->
<! -- Left screen [1] -->
<Appwidget
Launcher: packageName = "com. google. android. apps. genie. geniewidget"
Launcher: className = "com. google. android. apps. genie. geniewidget. miniwidget. MiniWidgetProvider"
Launcher: screen = "1"
Launcher: x = "0"
Launcher: y = "0"
Launcher: spanX = "4"
Launcher: spanY = "1"/>
<! -- Middle screen [2] -->
<Search
Launcher: screen = "2"
Launcher: x = "0"
Launcher: y = "0"/>
<Appwidget
Launcher: packageName = "com. android. protips"
Launcher: className = "com. android. protips. ProtipWidget"
Launcher: screen = "2"
Launcher: x = "0"
Launcher: y = "1"
Launcher: spanX = "4"
Launcher: spanY = "1"/>
<Favorite
Launcher: packageName = "com. android. Mms"
Launcher: className = "com. android. Mms. MainActivity"
Launcher: screen = "2"
Launcher: x = "0"
Launcher: y = "3"
/>
<Favorite
Launcher: packageName = "com. android. phone"
Launcher: className = "com. android. phone. MainActivity"
Launcher: screen = "2"
Launcher: x = "1"
Launcher: y = "3"
/>
<Favorite
Launcher: packageName = "com. android. Email"
Launcher: className = "com. android. Email. MainActivity"
Launcher: screen = "2"
Launcher: x = "2"
Launcher: y = "3"
/>
<Favorite
Launcher: packageName = "com. android. yuemei"
Launcher: className = "com. android. yuemei. MainActivity"
Launcher: screen = "2"
Launcher: x = "3"
Launcher: y = "3"
/>
<! -- Right screen [3] -->
<Appwidget
Launcher: packageName = "com. android. music"
Launcher: className = "com. android. music. MediaAppWidgetProvider"
Launcher: screen = "3"
Launcher: x = "0"
Launcher: y = "0"
Launcher: spanX = "4"
Launcher: spanY = "1"/>
<Appwidget
Launcher: packageName = "com. android. vending"
Launcher: className = "com. android. vending. MarketWidgetProvider"
Launcher: screen = "3"
Launcher: x = "1"
Launcher: y = "1"
Launcher: spanX = "2"
Launcher: spanY = "2"/>
<! -- Far-right screen [4] -->
</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.
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.
Daming Original: Reprint please indicate the source: http://blog.csdn.net/wdaming1986/article/details/6978814