Screen sizes and best background fit - android

What would be the best size or scale of width and height so I would only have to create 1 backround for a game to fit a screen or would I have to create the different densities to achieve the same affect to other screens?

if you want to do with single image you have to take a high density image so that it will support for all the screens in your XML file you need to mention width and hight as "matchparent"
the images sizes as follows
hdpi:
480 x 800
480 x 852
540 x 960
1024 x 600 (old 7" tablet)
1280 x 800 (7" tablet)
xhdpi:
720 x 1280 (not sure, I don't have this kind of device)
1080 x 1920
1920 x 1080 (10" tablet)

Android runs on a variety of devices that offer different screen sizes and densities. For applications, the Android system provides a consistent development environment across devices and handles most of the work to adjust each application's user interface to the screen on which it is displayed. At the same time, the system provides APIs that allow you to control your application's UI for specific screen sizes and densities, in order to optimize your UI design for different screen configurations. For example, you might want a UI for tablets that's different from the UI for handsets.
Although the system performs scaling and resizing to make your application work on different screens, you should make the effort to optimize your application for different screen sizes and densities. In doing so, you maximize the user experience for all devices and your users believe that your application was actually designed for their devices—rather than simply stretched to fit the screen on their devices.
A set of six generalized 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
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
Reference :- Supporting Multiple Screens

Related

Any way to match Android screen configuration to actual resolution

Based on this dashboard https://developer.android.com/about/dashboards/:
92% of Android devices are "Normal size with hdpi-xxhdpi density"
Unfortunately that info does not help to understand what the approximate resolution of those devices.
As I was digging through different sites to understand the concept of screen size and density I have found following concept:
normal screens are at least 470dp x 320dp
large screens are at least 640dp x 480dp
xlarge screens are at least 960dp x 720dp
As xxxhdpi refers to x4 scale I expect something like:
Normal screen with xxhdpi density will be < 1880x1280 pixels (typical 1920x1080?)
Large screen with xxhdpi density will be < 2560x1920 pixels (typical 2560x1440)
But then I found this table -https://material.io/tools/devices/
And it does not fit at all. For example:
Samsung Galaxy Note 4 - 5,7" 1440x2560 (515dpi) - xxhdpi (x3)
Nexus 6P - 5,7" 1440x2560 (515dpi) - xxxhdpi (x3.5)
As you can see, devices with identical screens goes to different buckets.
Can anyone tell what is wrong with my assumptions?
The reason I need this is because I developed a game for Android and I want to optimize it. My reference resolution for art is 2732 x 2048 (the largest for mobile devices). I want to build separate APK for usual 1920x1080 and lower resolution, so it will save disk space and RAM on user device.
While building android apps, it's important to know the DPI (Dots Per Inch) value, but in case you are not sure about the mobile device the user is using, the dpi may vary and hence, the concept of PPI (Pixel Per Inch) comes into play.
The problem with your assumption is that while considering PPI and DPI, always leave DPI and select PPI cause it will give you an accurate result. Both the phones have a different PPI and hence, the xxxhdpi goes up in case of Nexus6P as compared to xxhdpi Note 4
XXXHDPI= Extra Extra Extra High Dots Per square inch.
XXHDPI= Extra Extra High Dots Per Square inch.
Note that one 'extra' in their full form.
drawable-xxhdpi, 480 PPI (3 x 160 PPI)
drawable-xxxhdpi, 640 PPI (4 x 160 PPI)
As you can see the PPI varies and hence, Nexus 6P has PPI somewhere between that range.

Android Form Factor Metrics

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.

Screen density for xx-hdpi screens [duplicate]

The Google Nexus 10 comes out shortly, and is the first device to use xxhdpi resources. It sports a display density of about 300 DPI (according to the Nexus 10 website and this calculator).
However, when I go to the Android documentation, it states:
ldpi : ~120dpi
mdpi : ~160dpi
hdpi : ~240dpi
xhdpi : ~320dpi
xxhdpi is not specified.
How come the Nexus 10's 300 DPI screen is xxhdpi instead of xhdpi, and what should be the approximate DPI of xxhdpi? Should we even worry about having new resources (aside from icons) for xxhdpi at this point, or should we just let the OS scale up xhdpi resources?
According to the post linked in the G+ resource:
The gorgeous screen on the Nexus 10 falls into the XHDPI density
bucket. On tablets, Launcher uses icons from one density bucket up
[0] to render them slightly larger. To ensure that your launcher icon
(arguably your apps most important asset) is crisp you need to add a
144*144px icon in the drawable-xxhdpi or drawable-480dpi folder.
So it looks like the xxhdpi is set for 480dpi. According to that, tablets use the assets from one dpi bucket higher than the one they're in for the launcher. The Nexus 10 being in bucket xhdpi will pull the launcher icon from the xxhdpi.
Source
Also, was not aware that tablets take resources from the asset bucket above their level. Noted.
xxhdpi was not specified before but now new devices S4, HTC one are surely comes inside xxhdpi .These device dpi are around 440. I do not know exact limit for xxhdpi See how to develop android application for xxhdpi device Samsung S4
I know this is late answer but as thing had change since the question asked
Note Google Nexus 10 need to add a 144*144px icon in the drawable-xxhdpi or drawable-480dpi folder.
The DPI of the screen of the Nexus 10 is ±300, which is in the unofficial xhdpi range of 280‑400.
Usually, devices use resources designed for their density. But there are exceptions, and exceptions might be added in the future.
The Nexus 10 uses xxhdpi resources when it comes to launcher icons.
The standard quantised DPI for xxhdpi is 480 (which means screens with a DPI somewhere in the range of 400‑560 are probably xxhdpi).
480 dpi is the standard QUANTIZED resolution for xxhdpi, it can vary something less (i.e.: 440 dpi) or more (i.e.: 520 dpi). Scale factor: 3x (3 * mdpi).
Now there's a higher resolution, xxxhdpi (640 dpi). Scale factor 4x (4 * mdpi).
Here's the source reference.
The resolution is 480 dpi, the launcher icon is 144*144px all is scaled 3x respect to mdpi (so called "base", "baseline" or "normal") sizes.
The newer android phones in the market like HTC one, Xperia Z etc have resolutions in the >480dpi range, putting them in the new xxhdpi class as well. The new assets might be useful for them too.
A set of four generalized sizes: small, normal, large, and xlarge
Note: Beginning with Android 3.2 (API level 13), these size groups are deprecated in favor of a new technique for managing screen sizes based on the available screen width. If you're developing for Android 3.2 and greater, see Declaring Tablet Layouts for Android 3.2 for more information.
A set of six generalized 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
From developer.android.com : http://developer.android.com/guide/practices/screens_support.html
As per this PPI calculation tool, Google Nexus 10 has a display density of about 300 DPI...
However, Android documentation states that:
ldpi : ~120dpi
mdpi : ~160dpi
hdpi : ~240dpi
xhdpi : ~320dpi
xxhdpi is not specified.
I think we just let Android OS scale up xhdpi resources...

Android xhdpi density and resolution

I'm a bit confused and i hope you can help me. I'm developing an application for smartphones and i'm using prefixes like: mdpi, hdpi and xhpi. With first two i don't have any problems.
According to this:
http://developer.android.com/guide/practices/screens_support.html
and this
http://developer.android.com/about/dashboards/index.html
xhdpi is 640x960 px screen size and I have prepared my graphics for this resolution. But I can't find any device with this resolution. Instead of this, in android layout editor I have, for example, Galaxy Nexus which is marked as xhdpi device, but it has 720p screen size.
So my question is, I should look at this tables from documentation and believe that 25% devices has screen of size 640x960 px or I should change my graphics to the 720p screen size ?
If you develop only for phones and tablets for you is unnecessary you may not use xhdpi folder for your resources. If you want that your app works fine on modern devices such as Galaxy Nexus, Nuxus 4, etc you should support xhdpi screens.
large screens are at least 640dp x 480dp (hdpi)
xlarge screens are at least 960dp x 720dp (xhdpi)

Wallpaper Android Sizes

I need develop app to set an wallpaper.
What are the specification of wallpapers for Android? Sizes, mdpi, and ldpi hdpi?
Thanks,
They are actually ranges of pixel densities. Check out: http://developer.android.com/guide/practices/screens_support.html
They give approximate averages on that page of:
ldpi: ~120dpi
mdpi: ~160dpi
hdpi: ~240dpi
xhdpi: ~320dpi
nodpi: density independent
tvdpi: ~213dpi (mostly for TVs, apps shouldn't need it)
EDIT
This may be useful as well.
To create alternative bitmap drawables for different densities, you
should follow the 3:4:6:8 scaling ratio between the four generalized
densities. For example, if you have a bitmap drawable that's 48x48
pixels for medium-density screen (the size for a launcher icon), all
the different sizes should be:
36x36 for low-density
48x48 for medium-density
72x72 for high-density
96x96 for extra high-density
Also
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).
As you design your wall paper for different screen sizes, you'll discover that each design requires a minimum amount of space. So, each generalized screen size above has an associated minimum resolution that's defined by the system. These minimum sizes are in "dp" units—the same units you should use when defining your layouts—which allows the system to avoid worrying about changes in screen density.
xlarge screens wall paper are at least 960dp x 720dp
large screens wall paper are at least 640dp x 480dp
normal screens wall paper are at least 470dp x 320dp
small screens wall paper are at least 426dp x 320dp
Here you have a long list of Android Devices: http://en.wikipedia.org/wiki/Comparison_of_Android_devices
In the "Display" column you have sizes and resolutions of presumably all of Android Devices. You maybe want to do statistical summary?

Categories

Resources