简体   繁体   中英

Android developing for multiple devices

I have only ever programmed for the iphone and back then there was just one size and I did not have to worry about different screen resolutions and size. How in the world do I go about supporting multiple devices in android development? I have absolutely no clue and i've done some googling but it's not getting through to me.

Say I want a 15x25 grid of 32x32 tiles on my Nexus One. Well, how would I maintain the 15x25 oh a G1 or some other device?

This page has everything you need to know.

Obviously, you have several choices: You can scale everything so it looks the same, with just higher-quality graphics on a higher-res screen (for that, you can provide multiple versions of your images, see the link to see how). Or, if it makes sense, you can get the physical screen dimensions and adjust your code accordingly, ie you take the width, divide by a certain number, and that's your number of tiles. In most cases though, you choose the former approach.

Android supports a unit of measurement that is device-independent. That will help you make everything look the same.

In order to support multiple screens you will have to use DIPs instead of Pixels. This document is a must-read for any android developer:

Supporting Multiple Screens

thats easy. first don't worry! :) Second, get width and height of your screen and divide it to any number of tiles you want. this is the procedure that I did to develop a game for all types of screen sizes. see here: http://www.mobilesoft.asia/?p=47#more-47

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM