For the More Curious: 9-Patch Images
Sometimes (or maybe often), you will fall back to regular old image files for your button backgrounds. But what happens to those image files when your button can be displayed at many different sizes? If the width of the button is greater than the width of its background image, the image just stretches, right? Is that always going to look good?
Uniformly stretching your background image will not always look right. Sometimes you need more control over how the image will stretch.
In this section, you will convert BeatBox to use a 9-patch image as the background for the buttons (more on what that means in just a moment). This is not because it is necessarily a better solution for BeatBox – it is ...
Get Android Programming: The Big Nerd Ranch Guide, Third Edition 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.