July 2015
Beginner to intermediate
600 pages
18h 59m
English
Now, make your buttons round with a ShapeDrawable. 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. (Why is this one “normal”? Because soon it will have a not-so-normal friend.)
Listing 21.2 Making a round shape drawable (res/drawable/button_beat_box_normal.xml)
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="@color/dark_blue"/>
</shape>
This file creates an oval shape drawable that is filled in with a dark blue color. There are additional customization options with shape ...
Read now
Unlock full access