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

(gtxtreme123) #1

For the More Curious: More on Style Inheritance


You are now overriding the buttonStyle attribute and substituting your own style: BeatBoxButton.


Run BeatBox and notice that all of your buttons are dark blue (Figure 22.8). You changed the look
of every normal button in BeatBox without modifying any layout files directly. Behold the power of
theme attributes in Android!


Figure 22.8  The completely themed BeatBox


It sure would be nice if the buttons were more clearly buttons. In the next chapter, you will fix this
issue and make those buttons really shine.


For the More Curious: More on Style Inheritance


The description of style inheritance earlier in the chapter does not explain the full story. You may
have noticed a switch in inheritance style as you were exploring the theme hierarchy. The AppCompat
themes used the name of the theme to indicate inheritance until you arrive at the Platform.AppCompat
theme.



Here, the inheritance naming style changes to the more explicit parent attribute style. Why?

Free download pdf