Detailed explanation of skin formulation method of Android Simulator

Source: Internet
Author: User

The Android mobile phone OS can be modified through some operations in the simulator to meet your needs. Here we will introduce the concepts of Android simulators in detail. The Android simulator skin has a total of four standard methods, corresponding to the HVGA horizontal/vertical screen) and QVGA horizontal/vertical screen ), you only need to use the-skin <Skin Name> parameter when starting the simulator to load the corresponding skin.

  • Concepts related to the Android single-thread model
  • Operation tips for the Android dialog box
  • Brief Introduction to concepts related to Android SMS Service
  • How to Use the Android Gallery Control
  • Tips for implementing Android flash screen

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 location of the Android simulator skin the SDK. The default skin is placed in the $ ANDROID_HOME/tools/lib/images/skins/directory. We want to install the 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 HVGA 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 all the files except $ ANDROID_HOME/tools/lib/images/skins/templates and layout, so that all the resources required for customization are available, next, you only need to modify it.

In step 2, you can use paint.netmask to modify device.png in gimpwindows, Rotate 90 degrees counterclockwise, and zoom in and cut properly so that the screen area is exactly 800*600. Do not modify keyboard.png.

And so on.

Step 4: Modify the layout file. The structure of the layout file is easy to understand. The first part is the device part, which includes the background, display, and buttons. The next part is the keyboard area, includes the definition of the background image and the keyboard buttons; Part 1 is the overall layout of the simulator, including the window size (width, height), background color (color), the screen direction (event), and the location of the device part and the keyboard part it contains; Part 1 can modify the keyboard layout of the simulator (keyboard charmap ), network speed and latency ).

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. The buttons section of the device is temporarily put, while the background and buttons of the keyboard area do not need to be modified, so we came to the overall layout section, based on the data obtained when the device background is modified, set the window width and height to 1280*800, and the background color remains unchanged. I have not found the exact meaning of the event, but it will certainly affect the direction of the screen output content. EV_SW: 0: 1 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. I will explain this later ).

In this case, use. /emulator-skin WVGA command to open the simulator, we can see a relatively 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, the skin of a WVGA Android simulator has basically been completed, but there are still several issues.

1. If the resolution is 1280*800 in the notebook, the display area of skin is too large, and the keyboard part may not be displayed completely, causing inconvenience to the use.

The simulator also reports a warning: emulator window was out of view and was recentred

We can solve this problem through the-scale option. For our WVGA skin, it is okay to start the simulator with./emulator-skin WVGA-scale 0.9.

2. How to Use WVGA skin in eclipse

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, which is obviously better than set in the Android simulator skin ).

Related Article

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.