xhdpi is the largest density to date, right? - android

There's no such density as "xxhdpi", right? (I know there's "xhdpi", of course). I've got a partner asking for assets in that density, but I cannot find any documentation on that. Have I missed this somehow? Is there a complete list of all known density names? I don't see anything in here, xhdpi is the largest mentioned:
http://developer.android.com/guide/practices/screens_support.html
Thanks

There is xxhdpi from API 16 (jelly bean). You can find it in the newest version of ADT.
It seems that the dpi range of xxhdpi should between 400dpi-500dpi (I guess so), one of the evidence is that the HTC J Butterfly (or HTC DLX) uses xxhdpi and the screen is 441dpi.
In some cases, lower dpi devices may use higher dpi assets to display contents in a bigger size. For example, xhdpi Nexus 10 uses xxhdpi launcher icons.
References:
Official G+ shows that xxhdpi is 480dpi:
https://plus.google.com/118292708268361843293/posts/ePQya3KsTjW
ADT shows xxhdpi support:

As of ICS xhdpi is the highest density supported. You could of course name a folder layout-xxhdpi and put it in your resources directory, but I don't think android would know what to do with it.
(Note: I don't know if this is correct for Jelly Bean)
EDIT:
From Jens' comment I see that there are constants (added in Jelly Bean) for XXHIGH density. However, it says that applications likely won't need to worry about this as XHIGH graphics can be scaled up. I still don't see any information about something like a layout-xxhdpi folder, but perhaps those documentation pages simply haven't been updated yet.

Related

Android graphics for XXHDPI

I'm about to adjust all drawables for an Android app for XXHDPI devices (like sony xperia Z and samsung s4). After thorough reading on Google's documentation, blogs, and SO, I'm confused as to the graphics I'm about to produce.
My concerns are the following:
Google states that I shouldn't worry about this density as it scales up XHDPI graphics - In the same manner, (before XXHDPI devices) why the production of XHDPI graphics was a necessity and it didn't scale up HDPI graphics?
Sony reminds developers not to exclude XXHDPI screens without clarifying if this concerns making adjustments to graphics - Do I have to redesign all graphic elements for XXHDPI?
Based on (2), Sony Xperia Z Ultra has 342dpi density but it is categorized as an XXHDPI device. - If I produce the graphics for an XXHDPI, which is twice the size of an HDPI density, the graphics will scale down by almost 1/3 to match Sony's density and this is undesirable. Why doesn't Xperia Z use the XHDPI drawables? What if I have a pattern and I can't afford any scaling since I'll lose the detail of the pixel-perfect pattern?
Are XXHDPI resources REALLY necessary?
I hope somebody can answer all the questions above.
EDIT
Below are the results of slightly scaling a graphic to adjust to various densities
- xhdpi image (1:1) no scaling
- xhdpi scaled up by 10%
- xhdpi scaled down by 10%
The detail loss is obvious at 2nd and 3rd image.
Unless you actually need your graphics to be "pixel perfect", scaling up from XHDPI will probably be fine for almost all cases. Pixels are so small the user won't be able to tell the difference. Do you actually have an XXHDPI device you can see your graphics on? You might have to provide XXHDPI resources for some drawables, just like you sometimes have to provide MDPI drawables when the HDPI ones don't scale down well.
"do not exclude" in this context means explicitly from the manifest. Some developers target densities in their manifest and that will affect the app not showing in the Play store, this is unrelated to actual graphics.
From that same page, it actually says that the density of that device is 440 dpi? - "One of the awesome features you’ll find in the recently announced Sony Xperia Z is its 5” screen, which boasts a display density of 440 dpi,"
XXHDPI resources are essential for stuff like icons on modern devices. Google will change their story and start to recommend them when they release their own XXHDPI Nexus device.
Think about it this way: xxhdpi devices are pretty much the STANDARD Android devices. Little chance Samsung & HTC are going to roll everything back to XHDPI just because Google can't keep up.
1) Android scales the drawables selecting the drawable that will produce the best result https://stackoverflow.com/a/14004691/936414
2) The post only asks you to include xxhdpi screen support in manifest. All XXHDPI devices take resources from XHDPI and scale them to fit accordingly. So no need of separate resources in XXHDPI folder
3) No need to include resources for XXHDPI.

display density and resources usage (ldpi/mdpi/hdpi/xhdpi)

So I got HTC smartphone with 800x480 display. I always thought that it is HDPI device. And I was ensured using the following code:
Display display = activity.getWindowManager().getDefaultDisplay();
DisplayMetrics displayMetrics = new DisplayMetrics();
display.getMetrics(displayMetrics);
displayDensity = displayMetrics.densityDpi;
it says my device is 240dpi. But experimentally I'd discovered that android threats my device only as MDPI. Im sure bout this. I tested the same with another 800x480 (ZTE) and result was the same - it shows 240 in displayDensity but android threats it as MDPI device... But why is it so? On android.devepoler they said that 240dpi is HDPI. I'm totally confused. Why the heck 240 is threated as MDPI?
How I'd discovered that android treats my HTC as MDPI device:
In short what I made to ensure - I put a big image to drawable-hdpi (guessing AOS gonna use it) and smaller one to drawable-mdpi and than ran an app to see which it gonna use. And it always used image from drawable-mdpi instead of drawable-hdpi. To know how which image looks like on my device I ran app previously putting images to drawable folder of project.
However, like I mention above, I was guessing that my 800x480 HTC is HDPI due to code based on displayDensity but not on Configuration. Configuration says my device is Configuration.SCREENLAYOUT_SIZE_NORMAL and seems like thats the reason why AOS treats my device as MDPI only. So in conjunction with DisplayDensity of 240dpi (which must be HDPI instead of MDPI) it really frustrating. So now the question is why with Display density of 240dpi Configuration sets device to MDPI type? Whats the reason of this? I was thinking that the one and only way to detect the device type is its display density. And if it is 240dpi it must be HDPI device instead of MDPI.
You may try to read this page: http://developer.android.com/guide/topics/resources/providing-resources.html , it shows a complete explanation about screen density and others when you want to organize your resource folder.
About device being treated like MDPI it may be like Nexus 7, we were sure that it was MDPI, but it was using images from HDPI and also some values from MDPI/sw600dp (things that you will find better explained at that link above there), because its density, actually was TVDPI and so it's a 'middle' density between HDPI and MDPI. Try to download an app called ScreenInfo, on GooglePlay. It shows various informations about device screen, and may help you to make sure about your HTC.
Hope it helps.
Sorry for delay, so, first of all, you have to decide which public you want. You have to keep in mind that there are inumerous devices around there and it's almost impossible to cover all of them. I'd advise you to start with devices considered normal(screen normal, and MDPI density) because that is the baseline. And then, worry about others, based on that first one. Understand that the differentiation on resources folders are only done if necessary. In most cases, resources used to baseline works well for everyone.
Hope it helps.

Galaxy s4 res folder

Galaxy s4
Screen: 4.99", 1920x1080 (FullHD).
Which the res folder would be used in FHD and what's the dpi value should be set?
xhdpi or xxhdpi? And how can I calculate it?
I didn't find any info in the developer docs and in the screens_support article
It's 441 dpi, isn't it? So almost certainly xxhdpi, which is already supported in the Android framework. But why worry about it at this time? Assuming you're already supporting xhdpi, the likelihood that the average user can detect the different between xhdpi and xxhdpi assets is becoming increasingly small.
-- Edit --
Actually, I'd say it's certain to be xxhdpi, given that this is already in use with the new HTC One (which is at 468dpi).

I am confused with drawable-hdpi and drawable-mdpi

i am attempting to get my android app to work on both phone type devices and tablets. for the layouts i have layout-normal and layout-large and i place my xml files inside each and it seems to select the correct one for each device (layout-normal for phones and layout-large for tablets).
however the problem arises for the drawable folders. i have drawable-hdpi, drawable-mdpi and drawable-ldpi. the tablet is taking its images from the drawable-mdpi, and the phone is taking its images from the drawable-hdpi. from the reading i have been doing this seems to be backwards??? this seems to happen on both the emulator and real devices, could i be doing something wrong? am i mixing something up?
Clayton,
drawable-hdpi and drawable-mdpi is not related to the size of the screen itself, but to the resolution of the display.
It's probably easy to think in terms of the iPhone 3GS and 4 for this (bear with me please). The 4 has retina display, hence a much higher resolution. Using the same sprites you'd use with the 3GS would result in a blurry display.
Android phones are, if anything, much more diverse in terms of screen options.
If you want to be able to aim different layouts at different resolutions, please try putting the layouts into /layout-xlarge, /layout-large, etc...
You can find more here:
http://developer.android.com/guide/practices/screens_support.html
There are some changes that you can see for Android 3.2 and above:
Beginning with Android 3.2 (API level 13), the above size groups are
deprecated and you should instead use the swdp configuration
qualifier to define the smallest available width required by your
layout resources. For example, if your multi-pane tablet layout
requires at least 600dp of screen width, you should place it in
layout-sw600dp/. Using the new techniques for declaring layout
resources is discussed further in the section about Declaring Tablet
Layouts for Android 3.2.
ldpi, mdpi, and hdpi refer to pixel density, not screen size.
The accepted answer does not address a serious problem: if you have many drawables, you end up with an unnecessarily big apk file because of resource duplicating. The only solution for that is the resource alias option described here:
http://blog.evendanan.net/2011/03/Android-resources-and-device-fragmentation
Edit: I just beheld that OP didn't realize that most phones have hdpi density, while most tablets have mdpi density. At the same time the tablets mostly have higher resolution. Hence Android will use smaller pictures for higher resolution.
You can overcome this only by using vector images or using the methods described in the accepted answer and in my answer.
drawable-hdpi - application use this drawable images when the device has high pixel density
drawable-mdpi - application use this drawable images when the device has medium pixel density
drawable-ldpi.-application use this drawable images when the device has low pixel density

Drawables and Layouts for Galaxy Tab and Motorola XOOM

I'm testing my app at Galaxy Tab and Motorola XOOM emulator skins, and I can't understand, why the drawables are taken from the wrong folders. I have drawable-xhdpi folder, where I store big size pictures. However, Tab takes drawables from drawable-hdpi, and XOOM uses the drawable-mdpi folder. So, how do I manage my resources? Thanks in advance.
In addition, it feels like view sizes defined in sp are not ported properly. I have some views which need to be 80sp x 80sp, on phones with mdpi and hdpi screens they look right, but on tablets they look too small. Why can this be?
However, Tab takes drawables from drawable-hdpi, and XOOM uses the drawable-mdpi folder. So, how do I manage my resources?
There is no single "Galaxy Tab" device, so I have no idea which one you are referring to there. The XOOM is an -mdpi device. I would expect that the Galaxy Tab 10.1 would be -mdpi as well. However, in the end, device manufacturers will choose values that they feel deliver the best results for existing applications.
GalaxyTab 7" use "-large-hdpi"; XOOM 10.1" use "-xlarge-mdpi".
check this post for details:
GalaxyTab, Motorola Xoom Screen Desity and Size
I have test with multiple screen resolutions and find out Android use the following qualifier for different screen resolutions:
240x320: -ldpi
320x480: -mdpi
480x800: -hdpi
GalaxyTab7.1 inches: -large
GalaxyTab10.1 inches: -xlarge
Hope this information is useful for you.
Galaxy tab (the old one, running Android 2.x) is indeed not xhdpi. I had success by using the "large" qualifier to identify tablets. Else you can always use an API qualifier such as v11 for Honeycomb only resources.
Rather than using the dpi qualifiers you can use screen size qualifiers instead, theres info here on exactly what tags you can use when selecting which resources to use,
http://developer.android.com/guide/topics/resources/providing-resources.html
It's important to understand the difference between dpi and screen size, dpi tends to be high on phones, like a samsung galaxy s2, but on the big 10 inch tablets it tends to be low(which makes sense if you think about it, the phones squeeze more pixels into a smaller space).

Categories

Resources