Android OS device lie resolution solution!

Source: Internet
Author: User

Original article address:Http://blog.csdn.net/xiaominghimi/archive/2011/02/12/6180606.aspx

A question asked by the brothers in the group just now, I will share it with you here: the new emulator is configured as a device simulator with a resolution of 800*480 FOR THE waga800, when we obtain its height and width in our program, we find that it is always 320*533, obviously the system is lying to us! For example:

 

 

Below is the original official document:

Http://androidappdocs.appspot.com/guide/practices/screens_support.html

 

So why does the system lie about its resolution? What is its role?

In short, after sdk1.6 (SDK version 4), Android adds the new feature "multi-screen support ", the so-called new function is to make our games and software run smoothly and play well at different resolutions on different models. This function reduces the workload of porting, second, to better reflect the increasing momentum of Android.

Adaptive effects include: (WVGA high density (left), medium density (hvga), low density and qvga (right)

 

 

In terms of different resolutions, I want to play meide. A game and software can be used in two ways. One is that we make adaptive screen games when playing games, for example, we take coordinates based on the screen width, height, image width, height, and so on, rather than writing the dead position coordinates. The second is the adaptive technology of Android OS after 1.6;

However, in some cases, it is clear that android provides this kind of adaptive feature, which is sometimes not required or not suitable for our development (in fact, this is also similar to the current game engine, many people are asking me what engine is used for game development. In fact, the company has its own engine. I don't need an engine to write games on my own, because no game engine is suitable for all types of game development. For example, how can I use an RPG Engine to create a puzzle for continuous watching? --... Of course, there are already a lot of game development engines on the market, but the use of other game engines, for development, although the development efficiency, shorten the development cycle, but it is a headache for its scalability. So ~ We recommend that you absorb the knowledge and technology of these open-source engines and organize your own game engine. After all, it is much easier to expand your game engine! Instead, we can't just say that we can use and use other people's ways of thinking in our minds.) We cough up and return to the topic. As we said just now, sometimes we don't want to use the adaptability provided by Android OS, instead, we write self-adaption, which is more flexible.

The following describes how to avoid the adaptive method of Android OS:

Let's take a look at the official article:

 

 

 

Here is a piece of text taken from the official document. Here we are talking about the difference between the android SDK version 4 or earlier and the version 5 or later;

So we can see from here that android SDK 1.6 (version 4) does not support self-adaptation, so there is a solution;

We only needAndroidmainfest, Define<Uses-SDK Android: minsdkversion = "4"/>OK!

 

 

 

··· · 50 ······· · 90 ····· · 140 · 150
<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
Package = "com. desmo. testad" Android: versioncode = "1" Android: versionname = "1.0">
<Application Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name">
<Activity Android: Name = ". Test" Android: Label = "@ string/app_name">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
</Application>
<Uses-SDK Android: minsdkversion = "4"/>
</Manifest>
<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest xmlns: Android = "http://schemas.android.com/apk/res/android"
Package = "com. desmo. testad" Android: versioncode = "1" Android: versionname = "1.0">
<Application Android: icon = "@ drawable/icon" Android: Label = "@ string/app_name">
<Activity Android: Name = ". Test" Android: Label = "@ string/app_name">
<Intent-filter>
<Action Android: Name = "android. Intent. Action. Main"/>
<Category Android: Name = "android. Intent. Category. launcher"/>
</Intent-filter>
</Activity>
</Application>
<Uses-SDK Android: minsdkversion = "4"/>
</Manifest>

 

 

Then let's take a look at the modified XML operation:

 

 

This is normal. Here I want to apologize to everyone. As you can see, there have been no updates recently. The main reason is that I went back to my hometown for the New Year and just returned to work on my first day, the second point is that due to publishing a book, the contract for Tsinghua press has been signed, and a book on Android game development will be completed in the first half of the year ~ Everyone understands me. Of course, I must update my blog, but it will not be as fast as before.

The 21 articles I have written are basically useful for learning game development. I hope you will take a closer look, because many people ask what they have written. If you have any questions or questions, you can come to the Group to communicate and learn from each other.

Click OK and write it here. You will finish the books as soon as possible so that you can see them earlier.

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/xiaominghimi/archive/2011/02/12/6180606.aspx

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.