About android game resolutions

Source: Internet
Author: User

I use HTC G7 with a resolution of 480x800, but only 320x480. Because my game is a map grid of 40x40. It is reasonable to say that 12x20 grids can be displayed, but only 8x10 grids can be displayed. The same is true in the wvg800 simulator.

This problem has plagued me for a long time. I guess what the Android system does for resolution, such as 3.5 and 3.7 inch screens, all of which are 480x800. The resolution cannot be the same, there should be a concept similar to "density.

Later, I found this sentence on the Internet.

"To make the WVGA high-precision screen display the same size as the traditional hvga screen, whenProgramWhen not supported, the system will say that the screen resolution of the program is 320 × 533, after the drawing is completed in the (10, 10) to (100,100) area, the system will enlarge the image to the display area (150,150). "

That is, the android system will automatically scale our screens and process our resolutions as required by the system.

For more information, see add in androidmanifest. xml.

<Supports-screens Android: largescreens = "true"
Android: normalscreens = "true" Android: smallscreens = "true"
Android: anydensity = "true"/>

As a result, the game is miraculously normal. So I thought it was the configuration that played a role. Refer to the official documentation (I am not allowed to read English only)

Lets you specify the screen dimensions theapplication supports. By default a modern application (using API level 4 or higher) supports allscreen sizes and must explicitly disable certain screen sizes here;Older applications
Are assumed to support only the "normal" screen size
. Note that screen size is a separate axis fromdensity. Screen Size is determined as the available pixels to an applicationafter density scaling has been applied.

Based on the target device screen density, the android framework will scale down assets by a factor of 0.75 (low DPI screens) or scale them up by a factor of 1.5 (high DPI screens ). the screen density is expressed as DOTS-per-inch (DPI ).

The key to this problem is the blue part. sdks below 1.6 only support "normal" Resolution (320x480 ), as a result, the system reduced my 1.5 x (regardless of the coordinates, the length and width ),

In androidmanifest. XML, I changed the original minsdkversion = 4 to 7 (<uses-SDK Android: minsdkversion = "7"/>) and deleted the Section supports-screens. Everything is normal. The problem is the default value.

Based on the target device screen density, the android framework will scale down assets by a factor of 0.75 (low DPI screens) or scale them up by a factor of 1.5 (high DPI screens ). the screen density is expressed as DOTS-per-inch (DPI ).

Based on the size of the target screen, the android framework is reduced by 0. 75 or 1. 5.

References: G

Http://ucdchina.com/snap/7166

Http://blog.csdn.net/xiaominghimi/article/details/6180606

Http://www.eoeandroid.com/thread-68218-1-1.html

Http://www.gfan.com/dev/android/guide/topics/manifest/supports-screens-element.html

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.