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 of 320 dp will always be 2'' wide regardless of screen density. When it comes to the actual physical dimensions of a screen, this can be managed with a variety of layout types, libraries, and properties such as weight and gravity, but...