For the More Curious: 9-Patch Images
Use the content area to center the text within the buttons. Go back to
ic_button_beat_box_default.9.png and add the right and bottom lines as shown in Figure 23.12.
Enable the Show content setting in the 9-patch editor. This setting updates the preview to highlight the
areas of the image that will hold your text.
Figure 23.12 Defining the content area
Repeat the process for the pressed version of the image. Be extra sure that both your images are
updated with the correct content area lines. When 9-patch images are specified through state list
drawables (as they are in BeatBox), the content area does not behave as you might expect. Android
will set the content area as the background is initialized and will not change the content area while
you press on the button. That means that the content area from one of your two images is ignored! The
image that Android will take the content area from is not defined, so it is best to make sure that all of
your 9-patch images in a state list drawable have the same content area.