CoordinatorLayoutGradleSupport Design Library
compile 'com.android.support:design:22.2.1'
CoordinatorLayoutBehaviorBehaviorBehaviorChildDependencyChildViewViewCoordinatorLayoutViewChildCoordinatorLayoutViewDependencyChildViewgifViewDependencyViewChildViewViewDependencyViewChildViewBehaviorChildBehavior
app:layout_behavior="com.meizu.coordinatorlayoutdemo.RotateBehavior"/>
BehaviorCoordinatorLayout.Behavior<T>,TViewChildBehavior
publicbooleanlayoutDependsOn(CoordinatorLayout parent, Button child, View dependency) {
//如果dependency是view的实例,说明它就是我们所需要的Dependency
returninstanceof
}
//每次dependency位置发生变化,都会执行onDependentViewChanged方法
@Override
publicbooleanonDependentViewChanged(CoordinatorLayout parent, Button btn, View dependency) {
}
Behavior
AppBarLayout
LinearLayoutVerticalAppBarLayoutCoordinatorLayoutViewlayout_scrollFlags
layout_scrollFlags="scroll|enterAlways,
layout_scrollFlags=scrollView
layout_scrollFlags=“enterAlways” View
toolBar toolBar
app:layout_scrollFlags="scroll|snap"
layout_scrollFlags=scrollView
layout_scrollFlags=“snap” ScrollViewViewView
CollapsingToolbarLayoutFrameLayout
,CollapsingToolbarLayout,AppBarLayout
app:layout_collapseMode="parallax",表示视差效果app:layout_collapseMode="pin",当这个控件到达 CollapsingToolbarLayout的底部的时候,会代替整个CollapsingToolbarLayout显示