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?
- <? 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.
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.