The android simulator provides six standard skins for use, corresponding to hvga (landscape/landscape), qvga (landscape/landscape), wqvga, and WVGA, you only need to use the-skin <skin Name> parameter when starting the simulator to load the corresponding skin. This not only allows us to modify the appearance of the skin at will, but also allows us to set simulator parameters based on the new hardware spec when developing a new product based on Android, including resolution, button layout, network speed, network latency, etc. Now let's take a look at the custom Android simulator skin method. I will take a WVGA resolution landscape (landscape) skin as an example.
First, let's take a look at the position of skin the SDK. The default skin is placed in the $ android_home/platform/Android-*/skins/directory. We want to install a new skin, you just need to simply extract the skin to this directory. Considering the large number of keyboard buttons and the heavy workload of repositioning each, I will modify it based on wvga800 skin. The background and keyboard background of this skin are two pictures respectively, as long as the keyboard background size remains unchanged, the previously defined coordinates do not need to be modified and can be used in the new skin.
Step 1: copy the $ android_home/platform/Android-*/skins/templates and layout3 files and copy all the files except layout in the HVGA-L directory, in this way, all the resources required for customization are available, and you only need to modify them.
Step 2: Use gimp (you can use paint. Net in Windows) to modify background _ *. PNG for proper amplification and cutting, so that the screen area is exactly 800*600. Do not modify keyboard.png.
And so on. (Note: This step is not required)
Step 4: Modify the layout file. The structure of the layout file is easy to understand, including the background, display, and buttons. Next, the keyboard area contains the background image) and the definition of the keyboard button (buttons); Part 1 is the overall layout settings of the simulator, including the window size (width, height), background color (color), screen direction (event ), and the location of the device part and the keyboard part contained in the simulator. Part 1 can modify the keyboard layout (Keyboard charmap) and network speed of the simulator) and latency (network delay ).
Let's look at the layout file from the beginning. We first change the display width and height to 800 and 480 respectively, and fill in the coordinates in the upper left corner of the display area on the device background. In this way, the output resolution and position of the simulator are determined. For the buttons section, we can temporarily release it, while the background and buttons in the keyboard area do not need to be modified. Therefore, we came to the overall layout section, based on the data we learned when modifying the device background, for now, set the window width and height to 1280*800, and the background color remains unchanged,EventI have not found the exact meaning, but it will certainly affect the direction of the screen output content,Ev_sw: 0: 1This is what we can read.Then, set the location of device and keyboard in the entire window. Finally, we keep the keyboard layout as qwerty2, and the network settings remain the default value (which will be explained later ).
In this case, use./Emulator-skin wvgamyconfOpen the simulator command, we can see a normal Simulator Interface, the keyboard can also be used, the location of the display area is also basically OK, only the home and back buttons on the device are completely misplaced. Well, let's go back and modify the device's buttons positioning. At this time, we may need to change and try it. At the same time, we can display the location of the area and adjust the location of the keyboard.
Here, a WVGA skin has basically been completed, but there are still several issues.
InEclipseHow to UseWVGA skin
Choose run> RUN configurations> Target> emulator launch parameters to select the skin.
You can also enter-scale in "Additional emulator command line options" to zoom in the simulator window.
The network speed and network latency we mentioned earlier can also be set here (the setting here is obviously better than setting in skin ).
Question:
In the process of customizing skin, there is no problem for me to customize a 800*600, but why can't I display the simulator on the frontend when I customize a 1280*800? Is the relationship not supported by the simulator? Thank you for your advice.
Annex:
Standard |
Width |
|
Height |
Dar |
Pixels |
Hvga |
480 |
* |
320 |
3: 2 |
153,600 |
Qvga |
320 |
* |
240 |
4: 3 |
76,800 |
Wqvga400 |
400 |
* |
240 |
5: 3 |
96,000 |
Wqvga432 |
432 |
* |
240 |
9: 5 |
103,680 |
Wvga800 |
800 |
* |
480 |
5: 3 |
384,000 |
Wvga854 |
854 |
* |
480 |
|
409,920 |
In addition to, we can manually set the screen size through AVD manager.
Reference:
VGA: video graphics Array
Qvga: Quarter video graphics Array
Qqvga: Quarter qvga
Sub-qvga: Sub quarter qvga
CIF: Common intermediate format
Qcif: Quarter common intermediate format
Qqcif: Quarter qcif
Sub-qcif: Sub quarter qcif