0. Read this: http://developer.android.com/guide/practices/screens_support.html
Also, there are a few great blog posts on the topic in... Google

As I understand you're using Canvas. If so, you need to solve at least
two problems:
1. Multiple screen resolutions (320x240 -> 854x480)
2. Different aspect ratios (15:11 -> 15:8)

First you'll need to know screen dimensions and density at runtime.
See Display and DisplayMetrics.
You can then use these values to position your graphics on the screen.
Let's say you want a 50x50 image centered vertically and aligned with
the right side of the screen. Instead of (450, 135) draw it at
(screenWidth - imageWidth, screenHeight/2 - imageHeight/2) and now you
don't depend on screen or image resolution anymore. Avoid hard-coded
coordinates where possible and it will be much easier.
Next thing you need to do is scale your assets. You have a few
options:
1. You specify anyDensity="false" (aka "compatibility mode ON") in
your manifest, and let the device scale images based on its screen
density. Pros: easy. Cons: scaling artifacts, doesn't solve aspect
ratio issues, non-native resolution on large screens etc
2. You pre-scale your assets and prepare different image sets for
different screens. If you use /res, read this:
http://developer.android.com/guide/practices/screens_support.html once
again. If you place them in /assets, write your own loader which looks
for images with the right size/density/aspect qualifier.
3. You combine the 2 above methods. Let the device scale some images,
pre-scale others (may want to look at BitmapFactory.Options at some
point), resize some of them at runtime. Makes sense if you are porting
a J2ME game and implementing proper support for multiple resolutions
is too much work.

Hope this helps and good luck with your game.

On Apr 2, 11:11 am, massimo <[email protected]> wrote:
> Hi,
> I have a problem with my game.
> I'm making a game that need always be big on the screen. I have make a
> 2D game that have 480x320 resolution (for example the background image
> is so)...but if I try it on the emultator all go ok, but If I try it
> on Nexus the game is more little on the screen. How I can say to the
> game to be always max size on each screen?
>
> Ty

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to