Android CoordinatorLayout and Behaviors edit

Create dependencies between Views

You can use the CoordinatorLayout.Behavior to create dependencies between views. You can anchor a View to another View by:

For example, in order to create a Behavior for moving an ImageView when another one is moved (example Toolbar), perform the following steps:

public class MyBehavior extends CoordinatorLayout.Behavior<ImageView> {...}
public boolean layoutDependsOn(CoordinatorLayout parent, 
        ImageView child, View dependency) {
    // Returns true to add a dependency.
    return dependency instanceof Toolbar;
public boolean onDependentViewChanged(CoordinatorLayout parent, ImageView child, View dependency) {
    // Implement here animations, translations, or movements; always related to the provided dependency.
    float translationY = Math.min(0, dependency.getTranslationY() - dependency.getHeight()); 

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
150 CoordinatorLayout and Behaviors
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close