Mobile Design: Should I be using double resolution images? - android

The Galaxy S5 has a display resolution of 1920 x 1080, an iphone is 1334 x 750, and many others are similar. Do these resolutions work the same way that Apple's retina screens work, where images will look blurry unless they have an #2x size version?
Basically, if I am creating a mobile landing page for an add, and I use an image that is 300px wide in the browser, will that image look sharp like it does in the browser or do I need to do something else to make sure it looks good on mobile devices?

If you're talking about photos or photo-like images, Android resizes those fairly well and does a fair job of avoiding unpleasant image artifacts because it uses very accurate rescaling methods.
Anything you expect to be "pixel-perfect" like a 2px-wide line in the image is simply always to be somewhat blurry in a resized result. For those types of images, you'd want to generate different resolution versions of the images in the drawables-* (or mipmap-*) folders and keep in mind the relationship between screen density and pixels.
MDPI is 1:1
HDPI is 1.5:1
XHDPI is 2:1
XXHDPI is 3:1
XXXHDPI is 4:1 (and something you're unlikely to find right now)
...so if you wanted a 1px border in an image that's to be displayed on an XXHDPI screen, in the drawable file that line would need to be 3px wide. The good news is that since these downscale and upscale quite accurately, under most circumstances, an image from drawables-xxhdpi will retain a perfectly clean edge when downsized to all the others (except HDPI, because 1.5) and an image from drawables-mdpi will upscale decently as well. Android will do the best it can at picking an appropriate image to upscale/downscale from the drawables/mipmaps folders when some are missing (i.e., you might not need to populate all of them).

Android's support for higher resolution screens is based on screen density.
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
http://developer.android.com/guide/practices/screens_support.html
You need to create additional drawable folders and place your higher resolution images there. drawables-hdpi, drawables-xhdpi, drawables-xxhdpi, etc...
There are some tools that will help you resize images to the various densities too. Like this one: https://github.com/redwarp/9-Patch-Resizer

Related

How to use the different densities (mdpi, hdpi, xhdpi, ...)

I see a lot of post on this topic, however I haven't seen an explanation on what image size to take as a reference, let me explain.
I want to add a background image and make it suitable for each phone screen size so from mdpi to xxhdpi (if I'm not talking nonsense)
What size should my base image be?
I used a 600x1200 image and a 1080x1920 then converts using this site
https://romannurik.github.io/AndroidAssetStudio/
Unfortunately I noticed that on my two phones the image was distorted, I'm starting to think my base image size was wrong
So my question
What image size should I take to then create multiple densities ?
Sorry if it's redundant !!!
I'm starting to learn how to adapt and it's not that easy
If you want to create a background picture, your reference size is mdpi with 320x480px. You can then calculate the size according to the factor
hdpi: 1.5 (480x720)
xhdpi: 2.0 (640x960)
xxhdpi: 3.0 (960x1440)
xxxhdpi: 4.0 (1280x1920)
Note however, that nowadays devices have all kinds of other aspect ratios (mostly longer). So you have to design your background in a way, that the outer area does not contain important content. Then use ScaleType CENTER_CROP and your image should not be distorted (https://developer.android.com/reference/android/widget/ImageView.ScaleType)
I think the site is for (mainly launcher) icons.
If your target device's display has 1080x1920 size with xxhdpi (3x) density, just put an image of the size in the res/drawables/xxhdpi folder. No other densities are needed to be prepared. They will be re-scaled from the xxhdpi image if needed.
If you still want to prepare for those densities, first prepare the highest density. If you want to use xxxhdpi (4x), you should start with xxxhdpi sized image. Then scale it down to xxhdpi (3x), xhdpi (2x), hdpi (1.5x) and mdpi (1x).
xxxhdpi (4x): 100%
xxhdpi (3x): 75%
xhdpi (2x): 50%
hdpi (1.5x): 37.5%
mdpi (1x): 25%
Support different pixel densities: Provide alternative bitmaps

Background image size for tablets

I am creating an app with an full screen background image. I read a lot and made different images for different resolutions with the recommended pixel size and provide it in different drawable folders:
xxxhdpi: 1440x2560 px
xxhdpi: 1080x1920 px
xhdpi: 768*1280 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
I tested it on different phones and all look great.
Now my Problem: it doesnt't look great on tablets... and its logical. Samsung Galaxy tab 10 for example is 800*1280 mdpi.
So what is the solution? different folders for phones and tablets (7" and 10")? are there recommended sizes in pixels like there are for phones? how do others do this?
Thanks a lot for your advice!
If you are using drawables for background, and the image you added in the drawable surpass the dimensions from the list you supplied, it will be scaled by default (afaik).
Some things you have to keep in mind :
1) This applies both landscape and portrait.
2) If you are downloading the images from the web for creating the background drawable via code, you can handle the desired size by processing that image directly from the backend. Also, with libraries like Glide or Picasso, you can manage the resize thing.
Best regards,

Screen densities and sizes on android (Diff between large/x-large.. // hdpi, xhdpi...)

I've read so much about these things already, so many threads, but there still some things that I don't understand about how to, as a both developer and a designer, avoid problems with different sized screens.
So my question is mainly: What is the difference between putting drawables into mdpi,hdpi,xhdpi,xxhdpi folders as opposed to normal,large,xlarge folders? Should I do both?
I want drawables to act like this: If it takes 50% of the width of the screen on a smartphone, it should take 50% of the screen on a tablet. That's where I'm also confused - Both my phone and tablet are 1920x1080 and both fall into the xhdpi bucket (I believe), but their physical screen sizes are very much different.
Now I save drawables according to the mdpi, hdpi... ratios. Therefore I get results like this on the phone:
When I just out of curiosity created folders for drawables large and xlarge (I didn't know the ratios), I get this, which is closer to what I'm aiming for (but is obviously too big):
But what's the point of using the xhdpi (etc) buckets? Am I understanding this completely wrong? Someone please enlighten me. I hope this question makes sense. My point is - I want the scales of text and pictures to fill about as much of the screen on a tablet as on a smartphone.
Thanks
We developers just create drawbles for mdpi, hdpi, xhdpi, xxhdpi because screen resolution of devices maybe different. While in the case of the normal, large, xlarge folders it is used for the case of screen sizes.We Use This configuration qualifiers (mdpi, hdpi, xhdpi, xxhdpi) because for example for low budget phone, resolution maybe less and will show 48px drawable bigger while high end devices will show it smaller. That's why we create drawables for different resolutions of phones varying from 42(maybe) to 192 px.Similarly normal,large,xlarge folders are used in respect with screen size.
If you want to compress app size, you may use vector drawables. They are just created for one time and look consistent on every time.For Custom icons, export it to .svg or .psd format and create it as vector drawable through android studio.
Edit : I usually create my logo on Photoshop and android studio efficiently exports it to vector drawable.
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.
Vector drawables are put in drawables folder. There is one more advantage of using vector drawables that is one May animate it.
Note : Beginning with Android 3.2 (API level 13), these size groups small, normal, large,xlarge folders 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 use mdpi,hdpi,xhdpi,xxhdpi folders.
The configuration qualifiers (described in detail below) that you can use for density-specific resources are ldpi (low), mdpi (medium), hdpi (high), xhdpi extra-high), xxhdpi (extra-extra-high), and xxxhdpi (extra-extra-extra-high).
Screen Density of 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
Images Sizes as per folders.
36x36 (0.75x) for low-density
48x48 (1.0x baseline) for medium-density
72x72 (1.5x) for high-density
96x96 (2.0x) for extra-high-density
144x144 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density. Hope this will help.You ask me more about this in detail in comments.

Android UI manually resize - Autoscale?

Well, I'm working on the UI for my Android app. And regarding the variety of screen sizes and resolutions, I'm following the known recipe:
MDPI 160DPI 1X (1px)
HDPI 240 DPI 1.5X
XHDPI 320 DPI 2X
Considering this scale, it means manually resize all my icons and buttons on Photoshop, and then load them into the respective folders (mdpi,hdpi and xdpi).
Do you do this in the same way? There is some sort of "auto scaling mode" or something on Android?
All the best,
If you don't want to generate all the icons for all dpi fragmentation, there's a trick. Just generate the icons for xxhdpi or xhdpi and add them into the respective folder. Android itself will resize them in order to fit another fragmentatios but remember that the scale is always done from bigger sizes to smaller, not in the other way.
Hope that helps

Android drawable mdpi

I am working on a Android Project.
I put the images (320*480) into the mdpi -folder. There are some information in Android developer site that 480*800 tablets(7") also takes images from the mdpi- folder. When the 7" tablet takes images form that mdpi- folder it become smaller. There is only one mdpi- folder so how do i exactly manage it .
You should read the Android developer documentation on Providing Alternative Resources.
From my answer to this similar question:
The ImageView will render the image inside of it at the correct resolution for the device. As per the documentation on providing resources, you must make sure that you provide resources at the correct DPI for each of the resolution types. Android will pick the best resource resolution for you, but if only one resource exists then it will pick that one and try to render at the device resolution.
So, find out the correct DPI for your device, and add the image (at the correct DPI) into that folder and it should appear at the correct size. If the image is placed in the wrong folder then it will appear a different size. Another useful link is the Density Independence documentation.
Note: let's assume your device is an HDPI device. The res/drawables/drawable-hdpi folder might not exit in your project but you can just add it in manually.
Don't mix up screen size with screen density. There are qualifiers related to screen size (e.g. small, normal, large, ...) and qualifiers related to density (e.g. ldpi, mdpi, ...).
You can even combine these qualifiers, for example in drawable-normal-mdpi you can put resources that will be used on devices with normal screen (phones) with a mdpi density.
you should create ldpi, hdpi, xhpi folder too. And you need to copy your image with same name by calculating its ratio.
ldpi - mdpi - hdpi - xhdpi
3 4 6 8
There is a 3:4:6:8 scaling ratio between the four primary densities
(ignoring the tvdpi density). So, a 9x9 bitmap in ldpi is 12x12 in
mdpi, 18x18 in hdpi and 24x24 in xhdpi.
If you decide that your image resources don't look good enough on a
television or other certain devices and want to try tvdpi resources,
the scaling factor is 1.33*mdpi. For example, a 100px x 100px image
for mdpi screens should be 133px x 133px for tvdpi.

Categories

Resources