Android icons for different displays and screen densities - android

I'm completely confused to the core reading various articles to understand to get my app to fit in to different screen sizes. basically the issue i am having is to have a logo fit in to screens with different screen densities. I've got an image with a resolution of 1616x369 which fits in to Nexus 7" tablet and nexus 10" tablets I guess because they contain hdpi screen densities(which looks perfectly fine). but if I change the preview on eclipse to a 10" wxvga screen size which seem to contain an mdpi resolution the image gets pixelated. I know this is because I haven't specified an image in the mdpi folder for android to pick it up, hence it picks up the image from the hdpi folder. What I don't understand is to what resolutions should I create images for mdpi and ldpi folders based on my original image.

I'm not exact sure where I got this information from, but I believe there is a link to it within the Iconography | Android Development documentation.
Density Launcher Action Bar Small/Contextual Notification
mdpi 48x48 px 32x32 px 16x16 px 24x24 px
hdpi 72x72 px 48x48 px 24x24 px 36x36 px
tvdpi (use hdpi) (use hdpi) (use hdpi) (use hdpi)
xhdpi 96x96 px 64x64 px 32x32 px 48x48 px
xxhdpi 144x144 px 96x96 px 48x48 px 72x72 px

The size of the images changes depending what type of image you want.
Launcher icons
Action bar and tab icons
Notification icons
Navigation drawer indicator
Generic icons
Depending of where you will use your image it changes the size, so have the correct set for what you are using.
Then don't forget to copy the image to the folders ldpi, mdpi and so on. If you do this right,you will not get images pixelated.
Just go to this site
http://romannurik.github.io/AndroidAssetStudio/index.html
Click in what type of image you want and generate, select one image for example and download, then you can see the correct sizes. Hope it helps you.

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

Designing icons for android

I did some research and found that there 6 different sizes required by Android to display images properly on all sorts of devices.
LDPI - 0.75x
MDPI - Original size
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
So suppose I have 100x100 image as a baseline (MDPI), then ldpi, hdpi, xhdpi, xxhdpi will be as follows.
LDPI - 75x75
HDPI - 150x150
XHDPI - 200x200
XXHDPI - 300x300
XXXHDPI - 400x400
But I have confusion as to what should be the baseline(mdpi). How do I select my baseline, does it have to be based on something? I can have different images in my app example a back arrow, home arrow, a background image(full screen), an Add icon and so on. But all these icons have to different sizes. So how can I choose my baseline size?
No need to choose, the mdpi(baseline) density means that one dp is roughly equal to one pixel. So we call it the baseline density.
If we provide icon with size by the definition. We will get all the icon image have same physical size on different density screen(ldpi,mdpi,xdpi and so on) with proper quality.
About the background image, I would recommend to put the background image to drawable-nodpi which the image just fill entire screen no matter the density, so just put it there to let the system don`t scale the image and save some memory resources to scale it.
reference Support different pixel densities
Check if this can help you,
Material design icons

Android Image Base Size

I am building some graphics for an Android application and plan on making each image several times to fit the different DPI categorys such as ldpi, mdpi, hdpi and so on.
I am aware of the sizes each image needs for example, an MDPI image of 48x48 would be 72x72 HDPI 96x96 XHDPI ect. My question is, how do you know what size to make the base image (MDPI), say i am making a button for my home screen, how would i know the base dimensions that button needs to fit in the MDPI category and from there i can adjust it to the other categorys.
take a look at design at X, here is a good artcile Designing at 1x

What's the correct size icon for drawable-xxhdpi?

As we know, the correct sized icon:
* drawable-ldpi (120 dpi, Low density screen) - 36px x 36px
* drawable-mdpi (160 dpi, Medium density screen) - 48px x 48px
* drawable-hdpi (240 dpi, High density screen) - 72px x 72px
* drawable-xhdpi (320 dpi, Extra-high density screen) - 96px x 96px
On Jelly Bean, drawable-xxhdpi can be supported. So what's the correct size icon?
MDPI: 48x48
HDPI: 72x72
XHDPI: 96x96
XXHDPI: 144x144
XXXHDPI: 192x192
to create an icon for different densities, you should follow the 2:3:4:6:8 scaling ratio between the five primary densities (medium, high, x-high, xx-high, and xxx-high respectively)
- developer.android.com
This is a quote from a post on Google Plus https://plus.google.com/118292708268361843293/posts/ePQya3KsTjW by Nick Butcher
The gorgeous screen on the Nexus 10 falls into the XHDPI density
bucket. On tablets, Launcher uses icons from one density bucket up
[0] to render them slightly larger. To ensure that your launcher icon
(arguably your apps most important asset) is crisp you need to add a
144*144px icon in the drawable-xxhdpi or drawable-480dpi folder.
So, for the xxhdpi qualifier, you will need to create an icon of the size 144*144px for your launcher icon. You can either place it in the drawable-xxhdpi or the drawable-480dpi
EDIT: To add to the original answer to address cone of the comments by the OP.
As per this link: http://developer.android.com/guide/practices/screens_support.html#DesigningResources, alternative resources should be created using this ratio: 3:4:6:8 scaling ratio. However, if you are concerned about loosing quality with regards to your in-app drawable resource, consider using 9-patch images wherever possible. That will reduce or eliminate any loss of quality. The Android OS all by itself, does a remarkable job handling various screen sizes most of the time anyway.
As for the icon size 144*144px, create either of these two folder drawable-xxhdpi or the drawable-480dpi and place just your launcher icon of the said size in it. That should do it.
You need to add a 144*144px icon in the drawable-xxhdpi or drawable-480dpi folder.
For more information:-
Official G+ shows that xxhdpi is 480dpi:
https://plus.google.com/118292708268361843293/posts/ePQya3KsTjW
Standart icon size in dip is 48 dip.
You might use this service for creation all size icons. (Set size - 48 dip, and other settings)

Android: Background Image Size (in Pixel) which Support All Devices

I am creating an Application which will run on all Android Devices. I want to create xhdpi Graphics for My App. My App is full screen. I am confused in Creating graphics. can any one tell me the best sizes of my background image in pixels.
For Example:
xhdpi: 720x1280 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
Suggest me the best sizes which will appear on all devices good. Because my graphics are the core of my app.
I want that every device get the best image which it want. Android will be not involved in compressing or expanding of image.
The following are the best dimensions for the app to run in all devices. For understanding multiple supporting screens you have to read
http://developer.android.com/guide/practices/screens_support.html
xxxhdpi: 1280x1920 px
xxhdpi: 960x1600 px
xhdpi: 640x960 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
Android Devices Matrices
ldpi mdpi hdpi xhdpi xxhdpi xxxhdpi
Launcher And Home 36*36 48*48 72*72 96*96 144*144 192*192
Toolbar And Tab 24*24 32*32 48*48 64*64 96*96 128*128
Notification 18*18 24*24 36*36 48*48 72*72 96*96
Background 240*320 320*480 480*800 768*1280 1080 *1920 1440*2560
(For good approach minus Toolbar Size From total height of Background Screen and then Design Graphics of Screens )
For More Help (This link includes tablets also):
https://design.google.com/devices/
Android Native Icons (Recommended) You can change color of these icons programmatically.
https://design.google.com/icons/
Check this. This image will show for all icon size for different screen sizes
I looked around the internet for correct dimensions for these densities for square images, but couldn't find anything reliable.
If it's any consolation, referring to Veerababu Medisetti's answer I used these dimensions for SQUARES :)
xxxhdpi: 1280x1280 px
xxhdpi: 960x960 px
xhdpi: 640x640 px
hdpi: 480x480 px
mdpi: 320x320 px
ldpi: 240x240 px
GIMP tool is exactly what you need to create the images for different pixel resolution devices.
Follow these steps:
Open the existing image in GIMP tool.
Go to "Image" menu, and select "Scale Image..."
Use below pixel dimension that you need:
xxxhdpi: 1280x1920 px
xxhdpi: 960x1600 px
xhdpi: 640x960 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
Then "Export" the image from "File" menu.
My understanding is that if you use a View object (as supposed to eg. android:windowBackground) Android will automatically scale your image to the correct size. The problem is that too much scaling can result in artifacts (both during up and down scaling) and blurring. Due to various resolutions and aspects ratios on the market, it's impossible to create "perfect" fits for every screen, but you can do your best to make sure only a little bit of scaling has to be done, and thus mitigate the unwanted side effects. So what I would do is:
Keep to the 3:4:6:8:12:16 scaling ratio between the six generalized densities (ldpi, mdpi, hdpi, etc).
You should not include xxxhdpi elements for your UI elements, this resolution is meant for upscaling launcher icons only (so mipmap folder only) ... You should not use the xxxhdpi qualifier for UI elements other than the launcher icon. ... although eg. on the Samsung edge 7 calling getDisplayMetrics().density returns 4 (xxxhdpi), so perhaps this info is outdated.
Then look at the new phone models on the market, and find the representative ones. Assumming the new google pixel is a good representation of an android phone: It has a 1080 x 1920 resolution at 441 dpi, and a screen size of 4.4 x 2.5 inches. Then from the the android developer docs:
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
This corresponds to an xxhdpi screen. From here I could scale these 1080 x 1920 down by the (3:4:6:8:12) ratios above.
I could also acknowledge that downsampling is generally an easy way to scale and thus I might want slightly oversized bitmaps bundled in my apk (Note: higher memory consumption). Once more assuming that the width and height of the pixel screen is represetative, I would scale up the 1080x1920 by a factor of 480/441, leaving my maximum resolution background image at approx. 1200x2100, which should then be scaled by the 3:4:6:8:12.
Remember, you only need to provide density-specific drawables for bitmap files (.png, .jpg, or .gif) and Nine-Patch files (.9.png). If you use XML files to define drawable resources (eg. shapes), just put one copy in the default drawable directory.
If you ever have to accomodate really large or odd aspect ratios, create specific folders for these as well, using the flags for this, eg. sw, long, large, etc.
And no need to draw the background twice. Therefore set a style with <item name="android:windowBackground">#null</item>

Categories

Resources