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 (Listing 21.2). (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 21.2  Adding a style (res/values/styles.xml)

<resources>

    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="BeatBoxButton">
        <item name="android:background">@color/dark_blue</item> ...

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