The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.


Android 5.0 introduced a Toolbar widget, offering functionality akin to the action bar, but in the form of a ViewGroup that can be positioned where you need it. You can even use a Toolbar as an outright replacement for the action bar, for cases where you need a bit more control over the action bar implementation than you get by default.

In this chapter, we will explore the use of Toolbar. Note that an upcoming chapter will cover the use of a backport of Toolbar that works back to API Level 7… albeit with some issues.


Understanding this chapter requires that you have read the core chapters, particularly the one on the action bar.

Note that the examples in this chapter are clones of a couple from the core chapters. This chapter’s prose was written assuming that you were familiar with those samples, so you may need to go back and review them as needed.

One of the samples relies upon using a custom Parcelable class, which is covered in another chapter.

Basic Toolbar Mechanics

The preview of this section was stepped on by Godzilla.

Use Case: Split Action Bar

The preview of this section did not survive Thanos's finger snap.

Use Case #2: Replacement Action Bar

The preview of this section was accidentally identified as an Android 'tasty treat' by the Cookie Monster.