I'm developing a game for mobile devices and have come to the point where I need to adapt it to different aspect ratios.
I've looked around for the common Android aspect ratios but most resources only list the DPI value.
Anyone know any resources I may have missed, or might happen to know the common aspect ratios off the top of their head?
Typically I'm not a fan of providing links as answers, but there is a community wiki here on SO that is maintaining a list of Android aspect ratios. It contains 30+ devices so far.
Found here: Is there a list of screen resolutions for all Android based phones and tablets?
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc). = 3:4
480dp: a tweener tablet like the Streak (480x800 mdpi). = 3:5
600dp: a 7” tablet (600x1024 mdpi ~= 640x1024). 10:16
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc). 9:16
from: http://developer.android.com/guide/practices/screens_support.html
also: http://en.wikipedia.org/wiki/Comparison_of_Android_devices
Related
I cannot find the answer to this question anywhere on or off stack overflow:
Google defines common sizes and densities for devices as follows:
Sizes:
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Densities:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
My question is:
Which of these sizes corresponds to mobile phone devices? None of the sizes are portrait (height > width).
Say you are trying to figure out what dp to make a full screen bitmap to accommodate all mobile devices...
Generalizing a lot:
For phones (in portrait mode, width by height)
ldpi was typically 240 by 320
mdpi was typically 320 by 480
hdpi is typically 480 by 800 or 480 by 854 and lately 540 by 960
xhdpi is typically 720 by 1280 or 800 by 1280
xxhdpi is typically 1080 by 1920
xxxhdpi is typically ? by ? // who knows that? Feel free to edit, if absolutely sure.
For tablets, it's totally different.
But you asked for phones only.
You can't make best bitmap for all devices.
Many manufacturer set density via build.prop file ro.sf.lcd_density
so tablet could act like phone.
It's better to get current device values with getResources().getDisplayMetrics() and go with it.
You can set ImageView as background and continue with cropping options:
ImageView.ScaleType
After reading the Supporting Multiple Screens Android documentation several times over, and brainstorming a lot, I believe I have identified a couple of ways Google would like developers to generally go about this.
Legacy Solution:
Primarily, they wanted developers to use these small, normal, large, xlarge size qualifiers for drawable/ resource directories to allow Android to pick the correct resource to use.
I think the important thing to notice here, and I could be wrong, is that maybe they originally didn't want developers to have worry about whether the dimensions for these small, normal, large, xlarge sizes apply to a phone or tablet, but rather know they apply to both.
The caveat with that, of course, is that a full-screen image with landscape dimensions (width > height) will not look the same on a portrait device (height > width).
The solution using the legacy method would be to use an ImageView and set it's ScaleType appropriately, so it crops your tablet-sized image on mobile devices.
But there is another possible solution...
Alternate Solution:
There is a also a section on "New Qualifiers" for supporting different screen configurations. In this section, Google details qualifiers such as smallestWidth or available width, that could in theory, be used on your drawable/ resource directories to define proper portrait or landscape resources for your available device width.
For those familiar with web development, these qualifiers are the equivalent of CSS media queries.
As for specific widths to use, Google details some typical configuration examples:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800
hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
The only doubt left in my mind is that all of their examples use these qualifiers for layout, but not drawable resources. It begs the question whether this is the defacto solution they want developers to use for the given problem.
I am designing an android application in photoshop. But I am stuck at the first step itself.
I have so many confusion and after searching for a solution in google confusion increased threefold.
My big confusions are
1.What should be the canvas size
2.What is the size of status bar
3.How many sizes of assets i have to handover to development team.
Few suggested me to do everything in DP. Again confusion.
1.How to setup photoshop workspace in DP.
2.What is the size of the canvas I have to start with.
3.What is the size of status bar.
4.how to set text size in sp.
Thank you so much.
Consider dp = px in Photoshop
xlarge screens are at least 960dp x 720dp
large screens are at least 640dp x 480dp
normal screens are at least 470dp x 320dp
small screens are at least 426dp x 320dp
Following more specific
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Download the Sample android PSD from here
for more reference click here
I hope it would help you
Have declared next values folders.
values
values-sw320dp (... to 4'')
values-sw480dp (5'' to 5,5'')
values-sw600dp (7'' to 10'')
values-sw720dp (10'' to ...)
In each folder have one dimens.xml file with different margins, paddings, etc...
But don´t know what specific values folder need to work with display between 4'' and 5'', specifically 4,65'' and 4,7''.
Check the correct device resolution and follow the charts offered by Android:
http://developer.android.com/guide/practices/screens_support.html
Configuration examples:
To help you target some of your designs for different types of devices, here are some numbers for typical screen widths:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800
hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
in your case you will have your 4,65'' device in "values-480dp" folder.
From what I found, Samsung galaxy s2 has 480x800 resolution and s3 has 1280x720 resolution. So I believe I should ask my graphics designer to provide me hdpi graphics that contain 480x800 background images and to implement same background image in galaxy s3 mobile. Can I use image of size 1280x720 and put it in xhdpi folder so that it can work on s3.
The background image is something which covers whole available area for mobile app. so am I right in this approach ??
Why don't design in both resolutions?
See http://developer.android.com/guide/practices/screens_support.html for more detailed.
You should read Supporting multiple screens. You must define dpi on your emulator. 240 is hdpi, 160 is mdpi and below that are usually ldpi.
Extract from Android Developer Guide link above:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).
Hi guys i was wondering how to create an emulator environment for a tablet sized device, i know there are quite a few devices being released soon, but how do start sizing up my layout?
thanks
The Samsung Galaxy Tab has a 1024×600 resolution. You can easily Google resolutions for other devices that have been announced and create AVDs with matching specs.
You might also want to read up on Supporting Multiple Screens.
Configuration examples:
320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).
480dp: a tweener tablet like the Streak (480x800 mdpi).
600dp: a 7” tablet (600x1024 mdpi).
720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).