Custom CoordinatorLayout Behavior – Android Kotlin Tutorial

Learn how to create a custom CoordinatorLayout Behavior for views in your Android app!

In this tutorial we will create a ShrinkBehavior which will shrink a FAB whenever there’s a Snackbar displayed. With approach given in this tutorial, you will be able to create any behavior you wish, whether it is rotating the FAB or doing something completely special.

Also, behaviors don’t need to be applied only to floating action buttons. Any subclass of View can have a behavior as long as it is a child of CoordinatorLayout.


This post contains all the code that’s been written in this YouTube video.


You can also check out this GitHub repository:




FAB Code


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Development made simple

We're here to help you. If you have any questions, let us know.

Copyright 2017 - 2018 Reso Coder © All Rights Reserved