Modify the Android simulator size at will

Source: Internet
Author: User

If developers want to make some changes in the Android open-source mobile phone operating system, they need to use a simulator to perform corresponding operations. BKJIA also introduced the specific functions of Android simulators in related articles. Today, you can learn more about the simulator by modifying the size of the Android simulator.

  • Android Image Browsing source code
  • Android Quick Start Summary
  • Analysis of actual content of Android garbage collection
  • Android Background Program Application tips
  • Introduction to the callback method of the Android event listener

The Android simulator provides four standard skins for use, 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. 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/tools/lib/images/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 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.

To modify the size of an Android simulator, follow these steps:

Step 1: create a directory named WVGA in the $ ANDROID_HOME/tools/lib/images/skins/directory, and copy all the files in the examples and layout directories in the HVGA directory, in this way, all the resources required for customization are available, and you only need to modify them.

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.

At this point, the skin of a WVGA has basically been completed, but there are still several questions about the size modification of the Android simulator.

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 options. For our WVGA skin, we can 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.

In addition, you can enter-scale in "Additional Emulator Command Line Options" to zoom in the simulator window.

Not only is the size modification of the Android simulator, but the network speed and network latency we mentioned earlier can also be set here, which is obviously better than setting in 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.