Design Support Library

Table of Contents

Overview

The Design package provides APIs to support adding material design
components and patterns to your apps.

The Design Support library adds support for various material design
components and patterns for app developers to build upon, such as navigation
drawers, floating action buttons (FAB), snackbars, and tabs.

Setup

To get started you just need to add this line to your module's
build.gradle dependencies section:

dependencies {
...
compile 'com.android.support:design:22.2.0'
}

Components

Let's take a look at the different components.

I'm using Chris Banes' sample application Cheessquare for these examples.

CoordinatorLayout

Added CoordinatorLayout, a general purpose layout, used for building
dependencies between sibling views and allowing easy scrolling reactions
between components via CoordinatorLayout.Behavior. Many of the Design
Library components rely on being a child of a CoordinatorLayout.

AppBarLayout

Added AppBarLayout, a container for a Toolbar and other views (such as
TabLayout) for reacting to scrolling events by scrolling off the screen,
becoming visible in reaction to a downward scroll, or
collapsing/uncollapsing before scrolling off/onto the screen.

Detail Activity

The detail activity consists of a CoordinatorLayout containing an
AppBarLayout with the header image and a NestedScrollView with the
body content. When the NestedScrollView is scrolled down the header
image does a parallax effect as it scrolls up.

CollapsingToolbarLayout

Added CollapsingToolbarLayout for controlling how a Toolbar collapses.
A toolbar may collapse by: pinning components to the top of the screen
while it collapses, introducing parallax scrolling of components such as
an ImageView, or adding a content scrim color when the view is partially
collapsed.