Android Programming The Big Nerd Ranch Guide by Bill Phillips, Chris Stewart, Kristin Marsicano (z-lib.org)

(gtxtreme123) #1

Chapter 23  XML Drawables


Run BeatBox to see your nicely centered text (Figure 23.13).


Figure 23.13  New and more improved


Try rotating to landscape. The images are even more stretched, but your button backgrounds still look
good and your text is still centered.


Challenge: Button Themes


After completing the 9-patch image update, you may notice that something is not quite right with the
background of your buttons. Behind the dog ear, you can see something that looks like a shadow. You
may also notice that this shadow only shows up on Android version 21 and newer.


That shadow is part of the elevation that all buttons receive by default on Lollipop and newer (21+).
As you press the button, it appears to come closer to your finger (you will learn more about this in
Chapter 35).


With this dog-eared image, you want to remove that shadow. Use your new theme spelunking skills to
determine how that shadow is applied. Is there some other type of button style that you can use as your
parent for the BeatBoxButton style?

Free download pdf