Android Image Base Size - android

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

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 icons for different displays and screen densities

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.

Working with different screen sizes and different densities for resource drawables

I'm preparing drawables for my app. After some research, I came to know that 3 parameters that needs to be considered are Screen-size, Density and Resolution.
1.) Since for a particular screen-size, if density varies then corresponding resolution will automatically vary. Also, for a particular density, if screen-size varies then corresponding resolution will automatically vary.
Going by this logic, I removed resolution from consideration and planned to concentrate only on screen-size and density. Am I correct in this approach?
2.) Now as per documentation, if you are preparing 100x100 image for mdpi, then you should have 75x75 and 150x150 image for ldpi and hdpi respectively.
So I created an image resource drawable (.png) of size 100x100 with density 160 (mdpi). Then I created the same image with size 75x75 with density 120 (ldpi) and 150x150 with density 240 (hdpi) and placed them in respective drawables folders.
But after doing this, when I run the app on emulators having combination of different screen-size and different densities, the drawables just doesn't fit-in properly in the given space.
In some smaller screen-sizes, 3rd icon is getting cut halfway through.
Am I doing something wrong?
Any help appreciated.
Refer this:
You have to put your images in res/drawable folder by convention.
In res folder there could be more than one drawable folder like res/drawable-ldpi, res/drawable-mdpi, res/drawable-hdpi, res/drawable-xhdpi, and res/drawable-tvdpi.
You might be creating an app for different phones with different screen resolutions and screen sizes.
Android have a categorization of phone screens according to the dpi of the screen, namely ldpi, mdpi, hdpi, xhdpi, tvdpi (low, med, high, xtra high, tv respectively).
Your goal is to add each copy of images to these folders for each type of your target devices. For that you have to resize your images in the dpi ratio.
3:4:6:8 is the default dpi scaling ratio
More

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