Android. ldpi, mdpi, hdpi clarification - android

So, in regards to this stackoverflow accepted answer: How do I convert ppi into dpi for Android images?
So, ok, i make each background image the dimensions that that guy specifies in the answer.
BUT, if i define the other ImageViews (smaller ones), that are placed on the screen, in relation to the sizes defined above (e.g. let's say an ImageView has dimensions 20x20 for the hdpi devices, if i calculate this dimensions for the ldpi devices, the image would have to be 7x7 pixels, which is terribly small) then the ldpi devices won't be able to see anything on the screen :) Or will they? Am i doing it right, or not?
I'm terribly confused. Can someone clarify this for me please? :)

The resolutions mentioned in the other question will always fill the screen, but you should provide different layout files for each screen size to stay dpi independent (if you so wish).
Look at the example from the dev page
Also, it always helps to fire up the appropriate simulator (middle size with mdpi, smallest size with ldpi and biggest size with hdpi, depending on what devices you are planning to support) and try your layouts out.

Your images should be at least the size which can be easily viewable, or even clickable for the user on his/her devices.
The guidelines are for specific images, like launcher icons, or menu items, and not necessarily for any images you use in your app. For these kind of images, you are the best judge of specifying the image sizes and resolutions.
You could well have those images as only mdpi, and supply an hdpi version, so that it atleast has a higher resolution image for hdpi and xdpi devices.

Related

Designing full screen image for multiple size android screens

I want to create a full screen image which supports multiple screen sizes in android.
I know that there are 5 different sizes mdpi, hdpi, xdpi, xxdpi, xxxdpi. I also know that creating a 9 patch image seems to be the ideal solution. The problem is that the Android documentation always talks in dps, and dpis for the different screen densities (mdpi, hdpi, xdpi, xxdpi, xxxdpi) but as a developer at the end of the day I need to make the image in pixels.
So to avoid stretching, compression or any other distortion what should be the pixel sizes of the 5 images that I should make? Or are there other images sizes also to be made? I have spent a lot of time on this already, so if anybody has encountered and solved this problem then please post the screen sizes and why those sizes were chosen.
EDIT:
Is there any specific link I can refer to. I want the pixel*pixel sizes of the images to make which will handle each case properly. I know they will be approx, but I want good user experience with the least number of images, so that the apk size is small.
You can get many screen sizes on various devices. If you want the image not being altered and fit the screen exactly the size it is, you would need to create images for all possible screens.
The five groups you mentioned are for densities not for sizes. This is to have your icons and other objects roughly the same physical size across possible devices.
Your are probably looking for size qualifiers

which resolution images to design for different android drawables folder

hey everyone
I've been facing drawables and layout related issues for a few days....
there are drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi and drawable-xxhpdi folders in resources directory in android project
I've gone through the official android doc several times it definitely explains everything pretty welle.g scaling ratios for ldpi(0.75), mdpi(1), hdpi(1.5), xhdpi(2)but i couldn't find any information regarding which resolution to start with???
for example if i start designing graphics resources for xhdpi folder then which resolution i should go for???as there are many devices out there which lie in extra high density bucket but each having different resolutions, for example
Nexus4 (768x1280 xhdpi)
Nexus 10 (2560x1600 xhdpi)
Galaxy Nexus (720x1280 xhdpi)
same is the case with hdpi and mdpi bucket, lots of devices are there then which resolution images we should place in the corresponding folder????
please guide me guys m really in trouble
Look at #CommonsWare's answer.
I add that we are talking of dpi.
MDPI (160dpi)
HDPI (240dpi)
XHDPI (320dpi)
XXHDPI (480dpi)
XXXHDPI (640dpi)
Then:
to convert between dp and pixels use this formula:
px = dp × density ÷ 160
but i couldn't find any information regarding which resolution to start with?
For the vast majority of apps, if you are worrying about resolution, you are doing it wrong.
Ask yourself how you would write this as a Web app. Browser windows can have an arbitrary number of pixels of width and height, because the user can resize those windows as she sees fit. You are not going to design distinct imagery for a 1023x805 window instead of a 1037x740 window. Instead, you are going to take some approach that can handle a reasonable range of window sizes, perhaps with alternative artwork when you jump to a new range of window sizes.
Then, take that design approach, and apply it to your Android app. Focus on screen size and density, not resolution.
which resolution images we should place in the corresponding folder?
Resolution has nothing to do with density.
dpi has nothing to do with resolution. The dpi system is made so that a certain image will be (about) the same physical size no matter of the screen density, for example Google suggests that Buttons should be 48dp which is (about) 9mm on ANY density, but resolutions are different on any device, and including tablets you can't really worry about resolutions.
When making an app think about how you want to look, not in exact manners, for example "I want this line to have four buttons", make a LinearLayout with four buttons and you are done! (Sometimes you may want to include a horizontalScrollView depending on the size of the buttons).
Over time you will manage to understand this better, it's a matter of practise!

Supporting Multiple Screens for hundreds of icons

In my application I have to use hundreds of bitmap icons and we want to support multiple screen.
And through the documents at android developer, it seems that it is the only way to create these icons for different devices with different dpi.
If this is true, we will have a hard work, so I want to know if there is an alternative to avoid this?
Given the number of icons that you're dealing with, creating multiple versions of each manually is clearly out of the question.
I suggest that you create your icons at the xhdpi resolution, and come up with an automated process (perhaps using something like ImageMagick, and the scripting language of your choice) to produce the lower resolutions as part of your build process.
You don't have to provide different bitmap resources for all possible pixel densities, but ideally you would provide low dpi (ldpi), medium dpi (mdpi), high dpi (hdpi) and extra-high dpi (xhdpi) icon resources.
If you don't provide all of the above, the Android system will automatically pick the closest matching resource and scale it to match the actual screen pixel density.
Please visit Android Asset Studio wherein this site will provide all types of dp icon images of your requirement.
In your case, go for Generic icons section or Menu icons section.
Hope this helps.
You can put your images in /res/drawable, then Android would scale them according to dpi in order to keep the image to be roughly the same physical size regardless of display density. In this case an image would be unmodified in MDPI, 1.5x larger in HDPI, 2x larger in XHDPI, and 3x larger in XXHDPI.
You can also put them in /res/drawable-nodpi, in which case no image rescaling would be applied, but it is hardly ideal as the same image would be physically 3x smaller in XXHDPI than in MDPI.
All of the above methods have serious cons, so really the most sensible method is to put the correct sized images in their respective DPI folders. Your images should be drawn in a much larger resolution, so it should just be a matter of rescaling each image to different DPI sizes.

Correct graphics for Android devices in regard to small/normal/large/xlarge and ldpi/mdpi/hdpi/xhdpi?

Im new to Android development and Im still a bit confused about making the correct graphics for the different devices. In this document there is a table listing different screen resolutions and density but it confuses me... Now lets take a example. I need a full screen background for my app, so making the largest background image 800x1280 for Galaxy Note seems about right for me (I don't want to support tablets, only phones), and then I could make a 720x1280 for Galaxy S3 and its likes and 480x800 version for Galaxy S2 and its likes, but where should I then place those image files?
It seems to me that all those devices are in the high density range, but then how do the devices use the correct graphics? Should I manually control this, or should I simply use just one and the same graphics for all devices and let Android scale it (then there are the problem with aspect ratio, how do I overcome that?)?
Thank you
Søren
In resource folder, you can create drawable directories according to width/height.
Then, you can use resource qualifiers, for width - wdp or Examples: w720dp,w1024dp etc.
for height hdp. Examples:h720dp, h1024dp etc.
Alternatively you can categories Screen size as small, normal, and large and can place your images in respective drawables.
Refer to this post : http://developer.android.com/guide/topics/resources/providing-resources.html#QualifierRules
small: QVGA low density and VGA high density.
normal: WQVGA low density, HVGA medium density, WVGA high density.
large: VGA and WVGA medium density screens.
xlarge: HVGA screen. The minimum layout size for an xlarge screen is approximately 720x960 dp units.
Everything is provided at developer site. Please refer to this link
The answer posted by yogeshhkumarr is correct, but it is worth noting that, depending on what sort of background images you are using, you may be able to make use of a 9-patch image to solve your problem without having to make multiple versions of the same image.

How to work with android different resolutions?

How large should be the image in pixels to fit all resolutions?
480x800 or 480x854?
I need to do different image resolutions for all folders:drawable-hdpi , drawable-ldpi, drawable-mdpi?and if so, which resolutions are used?
Thanks
You want an image that will fill the entire screen? There are over 50 supported android phones, each with a different resolution. You can't expect to create an image of the exact size of each phone. Instead, you'll probably need to come up with a few different versions and then allow it to stretch to fill the full screen.
hdpi, ldpi, mdpi refers the density of pixels on the screen, not the screen size. Thus, one mdpi screen might be 320x480 while another might be 480x854.
Supporting multiple screens has lots of good information dealing with the different screen sizes and densities. Icon design has specific suggestions for pixels sizes for different icons at the different screen densities.
Jovan, without knowing the type and context of the image you are referring to, this is difficult for me to answer directly. I assume you have drawn the 480x800 / 480x854 numbers from the high density WVGA and FWVGA total screen sizes. The android developer article on screen size support may help: http://developer.android.com/guide/practices/screens_support.html
Yes, if your app will target multiple device with different densities.
Please check the table in the link bellows to see the different resolutions in each folder:
http://developer.android.com/guide/practices/screens_support.html

Categories

Resources