Styles

Now, update the buttons in BeatBox with a style. A style is a set of attributes that you can apply to a widget.

Navigate to res/values/styles.xml and add a style named BeatBoxButton. (When you created BeatBox, your new project should have come with a built-in styles.xml file. If your project did not, create the file.)

Listing 20.2  Adding a style (res/values/styles.xml)

<​r​e​s​o​u​r​c​e​s​>​

 ​ ​<​s​t​y​l​e​ ​n​a​m​e​=​"​A​p​p​T​h​e​m​e​"​ ​p​a​r​e​n​t​=​"​T​h​e​m​e​.​A​p​p​C​o​m​p​a​t​.​L​i​g​h​t​.​D​a​r​k​A​c​t​i​o​n​B​a​r​"​>​
 ​ ​<​/​s​t​y​l​e​>​

 ​ ​<​s​t​y​l​e​ ​n​a​m​e​=​"​B​e​a​t​B​o​x​B​u​t​t​o​n​"​>​
 ​ ​ ​ ​ ​ ​<​i​t​e​m​ ​n​a​m​e​=​"​a​n​d​r​o​i​d​:​b​a​c​k​g​r​o​u​n​d​"​>​@​c​o​l​o​r​/​d​a​r​k​_​b​l​u​e​<​/​i​t​e​m​> ...

Get Android Programming: The Big Nerd Ranch Guide, 2nd 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.