Android xhdpi density and resolution - android

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)

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.

what's the folder name for 1080p resource on android?

what's the folder name for 1080p resource on android?
I know mdpi support 320x480
hdpi support 480x800
xhdpi support 720p
Unfortunately it isn't that easy. Mdpi, hdpi and xhdpi are all select based on screen density - basically the size of the pixels - not the number of pixels. So, if your 1080p screen is very large, it could conceivably be an mdpi screen (yes, it happens). You have the alternative to use small, normal, large and xlarge as selectors but these aren't tightly defined. A 1080p screen should be xlarge but so should a 720p.
The document at http://developer.android.com/guide/topics/resources/providing-resources.html#AlternativeResources is useful.
This is a poorly worded question, but it seems like you are trying to support the new 1080 x 1920 phones coming out. The maximum pixel density that Android supports is 480 dpi, which is called xxhdpi.
A phone (3"-5" diagonal) at 1080 x 1920 will fall into the xxhdpi density, like the Samsung Galaxy S4 at 441 dpi. However, a tablet (7"+) at 1080 x 1920 will not be xxhdpi, so do not assume that density correlates to resolution.
You can clear about the Screen size, density pixels in android. I found tutorial Tips for designers and developers Android

Are XHDPI images meant for use with retina displays in Android?

Should we use XHDPI images for retina display in Android? If not, where should I place images/assets for the Samsung Galaxy S3.
Update:
I found a useful artical:
List of Android Devices with pixel density buckets
The Samsung Galaxy S3 got a density of around 309 pixels per inch. From the Android documentation on supporting multiple screen densities:
xhdpi: Resources for extra high-density (xhdpi) screens (~320dpi)
I think we can conclude that assets for the S3 should be placed in the xhdpi folder.

Android Images for various devices

I have question regarding Android Layouts.I have read the documentation of Layouts .My question is that while developing lets say if the images are placed in the folders named
drawable-hdpi
drawable-ldpi
drawable-mdpi
drawable-xhdpi
Does drawable-ldpi refers to the phones with smaller screen ,drawable-xhdpi for tabs and drawable-mdpi medium sized screen phones.
If not i have a image i need to be able to put into all types of devices namingly phone,tab
How can i do it.
usually, larger screens have higher DPIs, but that is not always the case. if you are trying to differentiate between phone and tablet screens, density is not the right way. use the following,
drawable: phones
drawable-sw600dp: 7" tablets
drawable-sw720dp: 10" tablets
alternatively, you can use the screen size: small, medium, large, xlarge. e.g., drawable-large. from the docs,
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
http://developer.android.com/guide/practices/screens_support.html
Googling Android xhdpi brings up the Android resource on how you should use these:
http://developer.android.com/guide/practices/screens_support.html
DPI means how many dots per inch there are. Some small phones fit lots of dots in, which gives them a high DPI. You should provide different sized images for different resolutions. Google recommends creating images in the ration of 3:4:6:8 for l, m, h and xh DPIs.

Categories

Resources