Search code examples
androidsizescreenresolutionscaling

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: enter image description here

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): enter image description here

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


Solution

  • 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.