I can't figure out how to produce drawables for the new "high-res" handhelds like the Galaxy Nexus, One X, Galaxy S3 etc that have a resolution of 1280x720 or higher.
I always try to make as few layout-versions as possible. Preferably just one but at times a layout-long and notlong is necessary. And make the xml smart enough to handle all devices. But that's only possible if the drawable resources are there to supply all the different resolutions and sizes.
All has been nice and smooth until the new big phones arrived and I find that the drawables are to small for them. No xxhdpi-folder yet from Google so I must be doing something wrong.
I know it's forbidden to mention pixels here but still you have to use photoshop or some other pixel based application to make the drawables. Therefore you need to know how big to make these drawables.
This is what i've done so far:
xhdpi: 640x960
hdpi: 480x640
mdpi: 320x480
ldpi: 240x320
The problem is that when a 1280x720 device gets the drawables from the xhdpi folder things starts looking bad, the images are too small and there's too much space between them.
What do you base your drawable source files on? xhdpi in 1028x720? That messes up the lower res versions for me.
I have an ad agency breathing down my neck wondering why it doesn't look as perfect as on the iPhone...
Well, as I said above I can't find any handhelds with Android on it that's got a resolution of 640x960. So I based all my images on 720x1280 instead and put the 640x960 resolution stuff in a large-hdpi folder.
Now my app looks great on the latest Nexus, the Galaxy S3, HTC One-X and all of the other newer hires models. I think the tablets when looking for resources will go for large first, then hdpi where they will find the 2x scaled images.
This is what I ended up with:
xhdpi: 720x1280
large-hdpi: 640x960
hdpi: 480x640
mdpi: 320x480
ldpi: 240x320
I have a Galaxy Nexus, and I use the xhdpi resource folder (at a 2.0 scaling factor) and the images look great. Do you have an example (screenshot preferably) of what issue you're having? If you're hardcoding spacing and sizes in pixels, then yeah, it'll probably look weird at higher densities. Are you trying to hardcode a background image 1:1 at a specific pixel size? If so, that's never a good idea on Android.
Related
I know this question have been asked several times, but, I am facing a unique problem, solution of which I have not been able to find.
I have images in drawable, drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi and drawable-xxhdpi in ratio of .75:1:1.5:2:3 respectively.
For most of the emulators, images are appearing perfectly well, but, for some of them, images are not appearing in proper proportion.
Like images appears well in 3.2" HVGA slider(ADPI) emulator- 320x480 mdpi, but, images do not appear well in 5.1" WVGA emulator- 480x800 mdpi. This is despite the fact that both are mdpi.
Why is it that despite both of them being mdpi, images appears well in one and do not appear in proper proportion in the other? How can I overcome this.
Edit:
Image where it shows mdpi:
3.2" HVGA slider(ADPI) emulator- 320x480 mdpi and 5.1" WVGA emulator- 480x800 mdpi.
EDIT2:
I think I had a similar issue where the dp wasn't being scaled well for monitor resolution. In the device settings under 'startup size and orientation', switch the scale to something like 4dp on device = 1px on screen.
In Android Virtual Device Manager:
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.
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).
What simulator resolution i should keep when developing application for Samsung galaxy s2 and galaxy s3 ?
What i found that samsung galaxy s2 has 480x800 resolution and s3 has 1280x720 resolution so what i have understood up till now that 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, I will use image of size 1280x720 and put 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 ??
You will need to create several emulators or get various devices.
There are some pretty important ones, so generally you need to make sure you have:
ldpi, mdpi, hdpi, xhdpi
and
small, medium, large, xlarge
Some people choose to exclude certain sizes (like small and ldpi) but htat's up to you,
if you go with some or all of the following, it should be a good start:
480x320 (SE Mini 10), 480x800 (GS2, Desire, etc), 1280x720 (GS3, Galaxy Nexus etc), 1280x800 (Note, Xoom, various other tablets)
HTC ChaCha (because it's landscape default)
You need to make sure you create resources in the relevant folders for each density, usually, I tend to ignore ldpi and just put resources in:
mdpi,hdpi and xhdpi (mdpi will be scaled down for ldpi devices,
automatically)
You may also need to create various portrait and landscape layouts in different sizes.
Reading this page provides most of the necessary information:
http://developer.android.com/guide/practices/screens_support.html
This page also contains important information regarding size distribution and popularity that is constantly up to date:
Android Stats
One thing that Android does for you is that it manages resolution. If you use the proper size formats (dp, sp, etc), your layout will scale to almost all resolutions. If you place images in the proper drawable folders (hdpi, ldpi, mdpi, etc), the OS will also swap those out as necessary.
Also, the emulator should handle resolutions for specific devices, if I recall correctly.
Desing lazout in smart way! Usualy it means don't put to mutch content in one layout.
Make sure that evrything looks good on smallest size and bigest size. It is better to treat tablets separetly. Read how providing alternative resources works, you can build sepereate layouts for each screen size.
Check if the hardware is available on that device before using it. hasSystemFeature() can be used for checking.
I am new to android, and I'm trying to make a game that draws some image/bitmap. I have separate folders for drawable, however the emulator for tablet(wxga) is drawing the bitmap from drawable-mdpi even though I have proper images in drawable-xhdpi folder. What can the issue be? It would be great if you can point in the right direction.
Thanks in advance.
The emulator is doing the correct thing.
Have you read the official docs?
wxga is 1280×768 pixels, combined with a 10 inch screen that is actually mdpi. You need to specifcy a smaller screen size to increase the dpi.
On a side note: Most large android tablets have in fact mdpi resolution. But be careful: the Samsung Galaxy 10.1 Tab reports that it has hdpi even though the screen is technically mdpi.