77

according to http://developer.android.com/training/multiscreen/screendensities.html

The following scale factors are mentioned

xhdpi: 2.0 hdpi: 1.5 mdpi: 1.0 (baseline) ldpi: 0.75

I was wondering what the scale factor would be for xxhdpi?

3
  • Does it even support xxhdpi? Not like Google to miss something out of the docs
    – musefan
    Sep 6, 2013 at 10:10
  • @musefan , android sdk creates a folder automatically since the start of this year atleast , called drawable-xxhdpi . Also S4 , HTC ONE , and Xperia Z are xxhdpi . I have seen them take resources from the xxhdpi bucket . they are way above the xhdpi (240) level Sep 6, 2013 at 10:13
  • see my answer here too Jul 27, 2016 at 7:10

2 Answers 2

284

In android.util.DisplayMetrics, you can see that scaling factor is 0.00625:

/**
 * Scaling factor to convert a density in DPI units to the density scale.
 * @hide
 */
public static final float DENSITY_DEFAULT_SCALE = 1.0f / DENSITY_DEFAULT;

Where as DENSITY_DEFAULT is 160 --> scaling factor = 1.0f / 160 = 0.00625.

sizeScale = DENSITY_DEFAULT_SCALE * DENSITY_DPI

From this:

  • ldpi = 0.00625 * 120 -> 0.75
  • mdpi = 0.00625 * 160 -> 1.0
  • hdpi = 0.00625 * 240 -> 1.5
  • xhdpi = 0.00625 * 320 -> 2.0
  • xxhdpi = 0.00625 * 480 -> 3.0
  • xxxhdpi = 0.00625 * 640 -> 4.0

Not exactly a rocket science, but hope this will be useful for someone :)

11
  • 3
    and tvdpi -> 1.3312501 (for example: plus.google.com/105051985738280261832/posts/6eWwQvFGLV8) Oct 20, 2015 at 17:32
  • 2
    I wonder if this is still true; the Google Device Metrics site lists both 3.5 and 4.0 scaling for xxxhdpi: design.google.com/devices. I'm not sure how to resolve that inconsistency...
    – lilbyrdie
    Apr 25, 2016 at 15:10
  • 4
    @lilbyrdie: it does still hold. See the comment for DENSITY_560 in android.util.DisplayMetrics
    – ozbek
    Apr 26, 2016 at 5:13
  • 1
    @ozbek: So even though the devices might be labelled xxxhdpi, internally they aren't? That also implies all graphics are scaled for them? That doesn't sound very efficient. I also see that there are four other intermediate densities... In any case, thanks for the info. That's exactly what I was looking for.
    – lilbyrdie
    Apr 27, 2016 at 18:57
  • 2
    @ozbek Really? That's insane. Perhaps we shouldn't be surprised. It's buried so deep in the documentation that even the Google developers themselves probably don't know it :)
    – the_new_mr
    May 3, 2017 at 17:44
6

If you look at Metrics and Grids you'll see that xxhdpi is 480 dpi which is 3 times that of the baseline (mdpi @ 1.0). In other words the scale factor for xxhdpi is 3.0

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.