androidx.coordinatorlayout:coordinatorlayout
Official Description: The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 14 or later.
CommonsWare’s Notes
CoordinatorLayout
is designed to help coordination among widgets for
runtime events.
The classic example is showing a Snackbar
or similar sort of content
at the bottom of the screen. It may be fine that the Snackbar
overlaps
some of your widgets, but other widgets you might prefer “move out of the
way” while the Snackbar
is on the screen. For example, you might want to
move a FAB such that the Snackbar
does not overlap it.
Otherwise, CoordinatorLayout
behaves much like FrameLayout
.
You tend to use it in conjunction with something else, such as a ConstraintLayout
,
for the actual “layout” of the widgets in terms of sizing and positioning.
In practice, many developers use a CoordinatorLayout
when documentation
for some library suggests to use it. If neither you nor library-supplied
widgets are doing anything special to take advantage of CoordinatorLayout
capabilites, it does nothing for you on its own.
Note that CoordinatorLayout
originated with the Design Support Library.
Many articles from 2017 and earlier will reference
android.support.design.widget.CoordinatorLayout
. Much of what was written
for that CoordinatorLayout
should still be relevant for the AndroidX
edition.
Documentation
Knowledge
- Android Design — Coordinator Layout #1: An Introduction (2018-01-20)
- Android CoordinatorLayout Examples – Toolbar, Collapsing Toolbar, Tabs, ViewPager (2017-11-19)
- Using CoordinatorLayout in Android apps (2016-07-19)
Versions
- Latest Stable: 1.1.0
- Latest Release Candidate: 1.1.0-rc01
- Latest Beta: 1.1.0-beta01
- Latest Alpha: 1.1.0-alpha01