Adding image resources

One of the most interesting challenges that Android offers is the vast number of screen densities and sizes that we have to cater for. This is particularly true when it comes displaying bitmap images, where there are two competing issues that need to be resolved:

  • Low resolution images display very poorly when stretched to fit on large or high resolution screens
  • High quality images use up far more memory than is needed when displayed on smaller, low density screens.

Screen sizes aside, the problem of differing screen densities is mostly solved with the use of density-independent pixels (dp).

Managing screen densities

Dps are an abstract unit of measurement based on a screen displaying 160 dpi. This means that a widget with a width ...

Get Android Design Patterns and Best Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.