Shape Drawables

Now, make your buttons round with a shape drawable.

Since XML drawables are not density specific, they are placed in the default drawable folder instead of a density-specific one. In the project tool window, create a new file in res/drawable called button_beat_box_normal.xml (Listing 22.2). (Why is this one “normal”? Because soon it will have a not-so-normal friend.)

Listing 22.2  Making a round shape drawable (res/drawable/button_beat_box_normal.xml)

<shape xmlns:android=""

    <solid android:color="@color/dark_blue"/>


This file creates an oval shape drawable that is filled in with a dark blue color. There are additional customization ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.