Images are a handy way of conveying information to your users without forcing them to read lots of on-screen text. Although you can add images to lots of different areas within your app, (such as your layout's background and the background of onscreen elements, such as buttons), the Android SDK provides a dedicated view for displaying images, called ImageView
.
We've already discussed how you can use density-independent and other relative units of measure to create a user interface that displays correctly across a range of different screens. However, ensuring your images look crisp and clear across a range of different screen sizes isn't quite so straightforward.
This makes ImageView
one of the more complicated views, but since images are such an integral part of most Android UIs, it's well worth taking the time to properly master Android's ImageView
.
In this section, I'll show you how to add drawables to your UI and the steps you should take to ensure these images display properly...