What Is The Difference Between -anydpi And -nodpi?

nodpi

These are density-independent resources. The system does not scale resources tagged with this qualifier, regardless of the current screen's density.

For instance:

  • drawable-nodpi/dot.png

The dot will appear small on xxhdpi, big on ldpi.

However, the resource resolver will match a specific qualifier if it exists.

For instance

  • drawable-hdpi/eg.png
  • drawable-nodpi-v21/eg.xml

On a Lollipop (API 21) hdpi device, the bitmap is used.

On a Lollipop (API 21) xhdpi device, the vector is used.

anydpi

These resources take precedence in any dpi.

For instance

  • drawable-hdpi/eg.png
  • drawable-anydpi-v21/eg.xml

On a Lollipop (API 21) hdpi device, the vector is used.

On a Lollipop (API 21) xhdpi device, the vector is used.

Reference

Note: anydpi was added in change Ic3288d0236fe0bff20bb1599aba2582c25b0db32.


I use drawable-nodpi for everything, including plenty of large graphics for my game. An undocumented consequence of scaling up your graphics with -anydpi is that it increases memory use exponentially. So if you have a 1MB graphic in drawable, it will get scaled to 4MB, 16MB, 64MB, or more depending on the resolution of the user device. And device resolutions keep going up. That scaling up doesn't actually increase the sharpness of the graphic, of course. Normally drawing actions are available to direct how large each graphic should be in relation to screen size anyway, no need to bloat the app. I don't use multiple resolution specific draw folders either to save on memory and housekeeping, although with those you at least have some reign on allocation. The -anydpi folder is a trap disguised as a convenience IMHO.