There are some examples for coordinator layout move floating action button upward while snackbar showing, but do you ever curious about how the whole layout interact with snackbar?
This is the example for the case. Just show how we can use Behavior to customize view intraction we want. Or, be more creative, you may have different needs.
Step 1. Implement new behavior
It's needed to check if the operating device supports snackbar.
Step 2. Implement custom view so that we can apply MoveUpwardBehavior to it.
In this case, we make the whole LinearLayout interact with snackbar.
It's very easy, as here said, just pass the class to DefaultBehavior annotation.
Step 3. Almost Done!
Add CustomLinearLayout into layout. Remember, it should be included by CoordinatorLayout!
But....why we don't even have to implement behavior for FAB?
Form the source code of android.support.design.widget.FloatingActionButton class, as you can see:
Yes, it actually has it's own Behavior implemented.
We can implement any kind of behavior we want in any views. It should be very interesting. :)