Optimized size and dpi for Android app images - android

My app has a background image and I would like to create different files of it for the sake of multiple screen support.
I sent this link (http://developer.android.com/guide/practices/screens_support.html) for a graphic designer but he asked me the dimensions in pixels that I want the images to be created with.
Considering that I have a graphic designer in my team and I don’t want to use a code to optimize the images loaded in memory (I only want to place the images in the correct folders for small, normal, large and xlarge screens), what are the most optimized size and dpi settings to generate it?
We are working with PNG files.
For the dpi we are following this:
ldpi Resources for low-density (ldpi) screens (~120dpi).
mdpi Resources for medium-density (mdpi) screens (~160dpi). (This is the baseline density.)
hdpi Resources for high-density (hdpi) screens (~240dpi).
xhdpi Resources for extra high-density (xhdpi) screens (~320dpi).
But for the dimensions I could only find this, which is in dp and not in px:
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

1 dp = 1 px on 160dpi screen.
But your best bet for screen dimens is to look here
http://developer.android.com/guide/practices/screens_support.html#testing
and scroll down to where is shows the screen dimens in pixels (eg: 1920x1080) (Table 3)
Then check which ones you need most by looking at the chart
http://developer.android.com/about/dashboards/index.html#Screens
but the first link will give you the most used screen dimensions in use by Android devices.

Related

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.

Background image size for all screens

I want to use background image in my app.But i am so confused about different screen sizes.I found this question:
Android: Background Image Size (in Pixel) which Support All Devices
But in answer he said xxxhdpi: 1280x1920 px but Lg G3 is xxxHdpi and screen resolution: 1440 x 2560
I need a roadmap.How should be my image sizes for all screens ? (mdpi,hdpi,xhdpi etc.)
Android devices' screen sizes in pixels and screen width in inches, can differ significantly from device to device.
To address this issue, google lets you use different resources per size/density category
See here for some more info.
Generally speaking, you must put the largest size image that you want to support for each dpi in the correct folder, and let android do the resizing.
You can also check the imageView's ScaleType attribute to choose how to scale the image to fit the view.
EDIT
the reason to use the different folders and not just one large image is that the larger the image, the more memory it consumes.
For example a 1920x1280 image is nice to have on a 1920 screen, but on a 320pixels screen the extra resolution is wasted and you have a lot of wasted memory used.
An easier way is to include one single image in your drawable directory, then, in the OnCreate function of your activity, create a bitmap to fit the screen and put it in an imageview that has width and height set to "wrap_content".
This should work for any device.
Read this link. In particular, I think what you're looking for is:
To create alternative bitmap drawables for different densities, you should follow the 3:4:6:8:12:16 scaling ratio between the six generalized densities. For example, if you have a bitmap drawable that's 48x48 pixels for medium-density screens, all the different sizes should be:
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
180x180 (3.0x) for extra-extra-high-density
192x192 (4.0x) for extra-extra-extra-high-density
and also:
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

Android Application Design to support multiple sizes

I am working on Andoid application for mobile only(Not for Tablet). So I am going to tell designer to make PSD for android screens. Generally I tell my designer for making application design on these three sizes and I use dimen to adjust layout for other devices:
320* 480 (and I put these images into mdpi folder)
480*800 (I put these images into hdpi folder)
800*1280 (I put these images into xhdpi folder)
So I want to know what size of PSD should I made from my designer.I am asking about complete screen size.
//For Designer
start design PSD file from 100% i.e design from XHDPI then need to downscale it to
75% for HDPI
and 50% for MDPI
//For Developer
start design for MDPI first then place drawables in appropriate folder
Baseline phone mdpi 320x480
from that you can increase you drawables as 1.5 for HDPI and 2 for XHDPI
Developer keep in mind while designing layout ref best Practices
1. Use wrap_content, fill_parent, or dp units when specifying
dimensions in an XML layout file.
2. Do not use hard coded pixel values in your application code
3. Do not use AbsoluteLayout (it's deprecated)
4. Supply alternative bitmap drawables for different screen densities
Different screen pixel ratio :-
ldpi = 1:0.75
mdpi = 1:1
hdpi = 1:1.5
xhdpi = 1:2
xxhdpi = 1:3
so lets take an image with about the size of 100X100:
for mdpi it should be 100X100
for ldpi it should be 75X75
for hdpi it should be 150X150
for xhdpi it should be 200X200
for xxhdpi it should be 300X300
http://developer.android.com/guide/practices/screens_support.html
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

size of app's background for various Android devices

I am designing a background for my app for all Android devices.
I was thinking what would be the size of the image in pixels?
From the developer site I found the following equation
px = dp * (dpi / 160)
Then, px depends on two variables.
First, dp, and we have
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
Second, dpi and we have
low-density (ldpi) screens (~120dpi).
medium-density (mdpi) screens (~160dpi).
high-density (hdpi) screens (~240dpi).
extra high-density (xhdpi) screens (~320dpi).
So where should I put my drawables in the Screen characteristic? I mean should I use "size" or "Density". If I classify my images using the "size" "dp", what is the dpi for these images?
and if I classify my images using the "density" "dpi", what is the dp for these images?
I am confused on how to finally size my images. Also, Maybe you can have a medium density screen with a large screen size, right?
There are many many different resolutions out there. For instance there could be 4 different devices which are:
640 px x 480 px
The difference is, some of these devices are mdpi, some are hdpi, xhdpi etc. meaning they could be described as "large", "medium" or "xlarge" screen types.
So, for an mdpi device which is 640x480dp the background would be 640x480px however, a device which is 640x480dp and hdpi would need a background which is 960x720px, you'll notice they're the same size "bucket" but have different densities and therefore different resolutions.
So, if you just want your background to fit as well as can be expected you'll need:
large-xhdpi
large-tvdpi
large-hdpi
large-mdpi
large-ldpi
(then the same for normal)
normal-xhdpi
normal-tvdpi
etc etc etc.
You're best bet however is to use an image which can stretch, a shape, tile or can be converted to a 9-patch because it would be a pain in the rump to make every background available for every device. If you were going to do it I would look up a resource descrivbing every screen dimension on the market currently and setting it via programmatic methods.

android how to support multiple screen

Thais is what I have done. I try to support this screen sizes:
xlarge screens 640dp x 960dp
large screens 480dp x 800dp
normal screens 320dp x 400dp
small screens 240dp x 400dp
So I create etc. background images with that sizes (640dp x 960dp, 480dp x 800dp, 320dp x 400dp and 240 x 400). I put images in folders drawabale-xhdpi, drawabale-hdpi, drawabale-mdpi and drawabale-ldpi.
When I have xlarge screen with hdpi density (it use images from hdpi folder), graphic is bad (images are not large enough). So how to use that xlarge image when I have hdpi density. Do I have to create more images and put them in some places? This is a game, I draw all in canvas, don't use layouts for drawing images.
Thanks.
You can add new drawables in a drawable-xlarge-hdpi folder
use this path to save your image
res/drawable-xhdpi/my_icon.png // bitmap for extra high density
Check this Supporting Multiple Screens for more clarifications of multiple screen support.
Take a look at this link - Providing Resources
You can have an image in drawable-xlarge-hdpi folder
always use relative layouts to support multiple screens. see here Android layouts for same density different diagonal length

Categories

Resources