Android Design — Coordinator Layout #1: An Introduction
The Coordinator Layout is described as a “a super-powered FrameLayout” according to the docs. It is used to facilitate how views within your layout interact with each other. This is done by creating or assigning specific Behaviors to these views. These Behaviors are core to what makes Material Design unique, and include familiar interactions such as sliding drawers and panels to swipe-dismissable elements and buttons that stick to other elements as they move and animate.
Let’s take a look at Behaviors and how they work. In our next article we shall show a simple example of how to create a Behavior that allows for basic interaction between views in a CoordinatorLayout
Behaviors
Behaviors are at the core of CoordinatorLayouts
. They represent interactions between 2 or more views in the same layout. They are normally categorized into the following:
1. Layout-Based Behaviors: E.g. when a Snackbar
appears from the bottom, the FloatingActionButton
immediately translates upwards to accommodate the incoming view as shown in Figure 1 on the left.
Anchoring is also a form of Layout-Based Behavior, for instance…