1.CoordinatorLayout的用处:
监听滑动控件的滑动通过Behavior反馈到其他子控件并执行一些动画。
注意:滑动控件指的是:RecyclerView/NestedScrollView/ViewPager,意味着ListView、ScrollView不行。
2.监听滑动控件:RecyclerView
自定义FloatingActionButtion.Behavior与系统自带的AppBarLayout.Behavior:

图1
图2
图3
3.我们自定义的FAB的Behavior:
图1
图2
4.效果图:
5.监听滑动控件:NestedScrollView

6.效果图:
7.监听滑动控件:ViewPager
这里采用ViewPager+TabLayout+Fragment + AppBarLayou
8.ViewPager里的Fragment布局,最好能上下滚动:

9.效果图:
