CollapsingToolbarLayout

public
class
CollapsingToolbarLayout
extends FrameLayout

java.lang.Object

↳

android.view.View

↳

android.view.ViewGroup

↳

android.widget.FrameLayout

↳

com.google.android.material.appbar.CollapsingToolbarLayout

CollapsingToolbarLayout is a wrapper for Toolbar which implements a collapsing app bar.
It is designed to be used as a direct child of a AppBarLayout. CollapsingToolbarLayout
contains the following features:

Collapsing title

A title which is larger when the layout is fully visible but collapses and becomes smaller as the
layout is scrolled off screen. You can set the title to display via setTitle(CharSequence). The title appearance can be tweaked via the collapsedTextAppearance and expandedTextAppearance attributes.

Content scrim

A full-bleed scrim which is show or hidden when the scroll position has hit a certain threshold.
You can change this via setContentScrim(Drawable).

Status bar scrim

A scrim which is shown or hidden behind the status bar when the scroll position has hit a certain
threshold. You can change this via setStatusBarScrim(Drawable). This only works on
LOLLIPOP devices when we set to fit system
windows.

Parallax scrolling children

Pinned position children

Child views can opt to be pinned in space globally. This is useful when implementing a collapsing
as it allows the Toolbar to be fixed in place even though this layout is moving. See
COLLAPSE_MODE_PIN.

Do not manually add views to the Toolbar at run time. We will add a 'dummy
view' to the Toolbar which allows us to work out the available space for the title. This can
interfere with any views which you add.

setScrimsShown

void setScrimsShown (boolean shown)

Set whether the content scrim and/or status bar scrim should be shown or not. Any change in the
vertical scroll may overwrite this value. Any visibility change will be animated if this view
has already been laid out.