34

How to prepare resources for Nexus 6? If I put images to xxxhdpi they will scale down and lose quality. I put images to xxhdpi they will scale up and lose quality. Why developers decided setup value 560dpi for density, if real density 493ppi is more closer to xxhdpi ~480dpi?

The Nexus 6 boasts an impressive 5.96” Quad HD screen display at a resolution of 2560 x 1440 (493 ppi). This translates to ~ 730 x 410 dp (density independent pixels).

Nexus 6 has a quantized density of 560 dpi, which falls in between the xxhdpi and xxxhdpi primary density buckets.

For the Nexus 6, the platform will scale down xxxhdpi assets, but if those aren’t available, then it will scale up xxhdpi assets.

xxhdpi ~480dpi
xxxhdpi ~640dpi
Rahul Tiwari
  • 6,851
  • 3
  • 49
  • 78
anber
  • 3,463
  • 6
  • 39
  • 68
  • 1
    "Why developers" questions like this usually are not suitable for Stack Overflow. – CommonsWare Feb 12 '15 at 12:42
  • 2
    `I put images to xxxhdpi they will scale down and lose quality. I put images to xxhdpi they will scale up and lose quality.` You get a better quality when images are scaled **down** (median approximation) rather than up (pixellation). – Phantômaxx Feb 12 '15 at 13:45
  • 4
    Is there an option to specify resources exactly for this phone? something like drawable-560dp – Display Name Feb 12 '15 at 13:45
  • 1
    Resolution 1440 x 2560 pixels (~493 ppi pixel density) xxhdpi – uvrpavan Mar 02 '15 at 06:17

3 Answers3

7

In the case of the Nexus 6, the manufacturer chose a quantized density of 560 (adb shell getprop ro.sf.lcd_density), even though the physical density is about 493 (getResources().getDisplayMetrics().toString()). Understanding why they might do this requires understanding the meaning of the quantized density and how it affects image resource rendering, which is explained here.

In short, the quantized density of 560 means that the scale factor employed to load/render images will be 3.5. In the words of D. Hackborn, 'The density ... is an abstract density bucket the device manufacturer has decided makes sense for their UI to run in. This is what is used to evaluate things like "dp" units and select and scale bitmaps from resources.'

Community
  • 1
  • 1
Jo Jo
  • 7,245
  • 5
  • 34
  • 49
7

You can use drawable-560dpi for 560 dpi. drawable-560dpi and drawable-xxxhdpi images are in same resolution.

Ramesh Bhati
  • 1,239
  • 16
  • 25
  • 2
    Re "drawable-560dpi and drawable-xxxhdpi images are in same resolution." No they aren't - the entire point of the question is due to 560dpi being inbetween xxhdpi and xxxhdpi in resolution. xxxhdpi is 640 dpi. What happens on devices if they specify themselves as 560dpi, such as Nexus 6, is they first look for filename in `drawable-560dpi`. If not found there, they look in `drawable-xxxhdpi`. If not found there, they look in `drawable-xxhdpi`. The found image is then scaled to the display rectangle. – ToolmakerSteve Jan 30 '19 at 00:53
2

I think it's a valid question. Some devices are between supported dpis( xxhdpi & xxxhdpi), using images will do unnecessary software scaling . I don't bother about the quality difference but it will affect the startup performance of the application. Check variable willscale in BitmapFatory , if this is true the platform will do unnecessary extra software scaling. Ideally hardware ui should scale this directly using openGL ES.