Search code examples
androidimagelayoutresolution

Different image sizes for resolution-specific Drawable folders


In the Android res folder, we are presented with a few different folders that deal with different resolutions for images. In the past I have only used one image with the same resolution in one folder, and this has worked well for my specific applications. However, I'm hoping to make my future Android apps look essentially the same across an array of screen resolutions and devices. Any rules or guidelines to go by when creating different resolution sizes for the same image to put in each folder (i.e., should images that go in the medium resolution folder be 1.5x the size of those in a low resolution folder, etc.)?


Solution

  • What you're looking for is the scale-factor for each folder. This works by taking the mdpi folder as the "base" scale of 1.0.

    Scale-factors for each folder are as follows:

    • ldpi > 0.75
    • mdpi > 1.0
    • hdpi > 1.5
    • xhdpi > 2.0
    • xxhdpi > 3.0
    • xxxhdpi > 4.0

    So, for example, taking a 48*48px image as your base mdpi image, you'd end up with 32, 48, 72, 96, 144 and 192px images.

    Fore more detail, including the source for each of these values, check out shoe-rat's excellent answer from which I sourced much of this one.