android relationship between mdpi, hdpi, xhdpi, xxhdpi how to calculate - android

android image size different mdpi, hdpi, xhdpi, xxhdpi ? i have a mdpi image 20*20 how to measure hdpi, xhdpi, xxhdpi how to make other resolution image
different screen sizes due to Android having set standard size ?

Here is the scale factor list for each density:
ldpi = 0.75x
mdpi = 1.0x
hdpi = 1.5x
xhdpi = 2.0x
xxhdpi = 3.0x
xxxhdpi = 4.0x
So for example, if your mdpi image size is 20x20 then xhdpi size should be 40x40

you can use the following chart
mdpi 20 * 20 pixels
hdpi (mdpi * 1.5) 30 * 30 pixels
xhdpi (mdpi * 2) 40 * 40 pixels
xxhdpi (mdpi * 3) 60 * 60 pixels

Related

Android image size confusion

I'm very confused about making drawables for Android.
Let's say I want to make a big image that will fill 30% of the screen, or a certain amount of dp, like 300dp.
What size should that image be in pixels for each screen density, and in what dpi should I save it in?
For 300dp, you need:
300px for mdpi (1x)
450px for hdpi (1.5x)
600px for xhdpi (2x)
900px for xxhdpi (3x)
1200px for xxxhdpi (4x)
https://developer.android.com/guide/practices/screens_support.html
ldpi - 0.75 * mdpi ,
mdpi - 1 * mdpi ,
hdpi - 1.5 * mdpi ,
xhdpi - 2 * mdpi ,
xxhdpi - 3 * mdpi ,
xxxhdpi - 4 * hdpi ,
so if you want to generate for mdpi screen to be 300dp the image should be resized according to the above calculation

Different DPI Screen Resolutions (PIXELS)

i just wanted to know. i've read about this DPIs and i wandered all of the varieties. since i am new to this, i need some knowledge and i hope someone can help me out. so far i've seen LDPI, MDPI, HDPI, XHDPI, XXHDPI, XXXHDPI.
is there any other DPI variety other than this. and what is their respective resolutions ?. like as for qHD = 960 x 540 etc etc. i hope you understand guys, thanks.
please forgive me if my grammar is a little crappy, as english is not my native language
Android supports different screen resolutions
ldpi (low) ~120dpi
mdpi (medium) ~160dpi
hdpi (high) ~240dpi
xhdpi (extra-high) ~320dpi
xxhdpi (extra-extra-high) ~480dpi
xxxhdpi (extra-extra-extra-high) ~640dpi
1 dpi = 1 design independent pixel
ldpi device have 120 pixels in 1 inch size.
same for other densities...
we as programmer should use this conversion formulae :
pixel = dp * (density / 160)
so 240 dpi hdpi device's 1 dp will have = 1 * (240/160) = 3/2 = 1.5 pixels
and 240 dpi xxhdpi device's 1 dp will have = 1 * (480/160) = 3 pixels
Using this 1.5 and 3 pixels knowledge, programmer can design layouts for different densities

Image resolution for mdpi, hdpi, xhdpi and xxhdpi

I have a background for my app in resolutions 720x1280 pixels, 1080x1920 pixels and 1440x2560 pixels.
In which folders (mdpi, hdpi, xhdpi and xxhdpi) should I put each background?
Please read the Android Documentation regarding screen sizes.
From a base image size, there is a 3:4:6:8:12:16 scaling ratio in drawable size by DPI.
LDPI - 0.75x
MDPI - Original size // means 1.0x here
HDPI - 1.5x
XHDPI - 2.0x
XXHDPI - 3x
XXXHDPI - 4.0x
For example, 100x100px image on a MDPI will be the same size of a 200x200px on a XHDPI screen.
Require Screen sizes for splash :
LDPI: Portrait: 200 X 320px
MDPI: Portrait: 320 X 480px
HDPI: Portrait: 480 X 800px
XHDPI: Portrait: 720 X 1280px
XXHDPI: Portrait: 960 X 1600px
XXXHDPI: Portrait: 1440 x 2560px
Require icon Sizes for App :
http://iconhandbook.co.uk/reference/chart/android/
DP size of any device is (actual resolution / density conversion factor).
Density conversion factor for density buckets are as follows:
ldpi: 0.75
mdpi: 1.0 (base density)
hdpi: 1.5
xhdpi: 2.0
xxhdpi: 3.0
xxxhdpi: 4.0
Examples of resolution/density conversion to DP:
ldpi device of 240 X 320 px will be of 320 X 426.66 DP. 240 / 0.75 = 320 dp 320 / 0.75 = 426.66 dp
xxhdpi device of 1080 x 1920 pixels (Samsung S4, S5) will be of 360 X 640 dp. 1080 / 3 = 360 dp 1920 / 3 = 640 dp
This image show more:
For more details about DIP read here.
Check the image above I hope it will help someone.
Link to the whole article itself
Your inputs lack one important information of device dimension.
Suppose now popular phone is 6 inch(the diagonal of the display), you will have following results
DPI: Dots per inch - number of dots(pixels) per segment(line) of 1 inch.
DPI=Diagonal/Device size
Scaling Ratio= Real DPI/160.
160 is basic density (MHDPI)
DP: (Density-independent Pixel)=1/160 inch, think of it as a measurement unit
in order to know the phone resolution simply create a image with label mdpi, hdpi, xhdpi and xxhdpi. put these images in respective folder like mdpi, hdpi, xhdpi and xxhdpi. create a image view in layout and load this image.
the phone will load the respective image from a specific folder. by this you will get the phone resolution or *dpi it is using.

Screen size and dpi of bitmaps

I found two approximations of how developer should support bitmaps for different screen sizes. One is this:
ldpi low density 120 dpi
mdpi medium density 160 dpi
hdpi high density 240 dpi
xhdpi extra high density 320 dpi
The other is this:
xhdpi: 2.0
hdpi: 1.5
mdpi: 1.0 (baseline)
ldpi: 0.75
This means that if you generate a 200x200 image for xhdpi devices, you
should generate the same resource in 150x150 for hdpi, 100x100 for
mdpi and finally a 75x75 image for ldpi devices
Does it mean that If I take as a baseline 640x360, I have to make following 4 groups of images:
1) ldpi - size 480x270 pixels and density 120 dpi
2) mdpi - size 640x360 pixels and density 160 dpi
3) hdpi - size 960x540 pixels and density 240 dpi
4) xhdpi - size 1280x720 pixels and density 320 dpi
You are misunderstanding.
The documentation is not saying different things. The second part you reference is telling you how much bigger an image is in relation to the base density of mdpi
e.g xhdpi fits 2x the amount of horizontal and vertical pixels into the same space that mdpi would.
mdpi = 160 dpi (scale factor 1)
xhdpi = 320 dpi (x2 twice as dense as mdpi therefore an image in this folder needs to be twice as high and twice as wide as its mdpi counterpart to appear the same size on an xhdpi screen)

Android background image size in pixel

I would like to create a background image for different resolutions in Android. So I need the values (in pixel) for ldpi, mdpi, hdpi,xhdpi and xxhdpi. It is important that the image will not be blurred.
I have already read the Documentation about multiple screen support but there are sizes in dp instead of pixel.
Try follow below android icon graphy size reference for various device screen resolutin.
ldpi mdpi hdpi xhdpi xxhdpi xxxhdpi
Launcher And Home 36*36 48*48 72*72 96*96 144*144 192*192
Action Bar 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 320*426 320*470 480*640 720*1280 1080*1920 1440*2560
there is no full list of screen resolutions, there are no fixed values in pixels for ldpi, mdpi, hdpi,xhdpi and xxhdpi. Every android device may have different resolution. If you want to fill all resolutions you will have to create too many images. If you put them in your app, it will make the app size huge. Maybe a better approach is to use composite image for background.
According to android documentation
mdpi is baseLine size
we can use it to measure all other scales , that mean if mdpi (scale 1) equal 1 xhdpi (scale 2) should equal 2 , multiplay mdpi sizes in scale value
all sizes width x height in pixel
xxxhdpi: 1280x1920 px // 4x
xxhdpi : 960x1440 px // 3x
xhdpi : 640x960 px // 2x
hdpi : 480x800 px // 1.5 x at least 480x720
mdpi : 320x480 px // baseline = 1x
ldpi : 240x360 px // .75 x
** notice I add xxhdpi with 3.0x scale to image*
xhdpi: 640x960 px
hdpi: 480x800 px
mdpi: 320x480 px
ldpi: 240x320 px
i think it is rather easy to convert the DP into pixels in andorid java i am achieving this with this function that i created
int getPixels(Context context, float dp) {
return (int) (context.getResources().getDisplayMetrics().density * dp + .5f);
}
hopefully this is helpful for people,
and kindly do share your views on it, as i would like to get this conversion as accurate as possible, thankyou

Categories

Resources