1.CoordinatorLayout 是Design报下的面的一个布局文件,通过该布局文件可以组合成很多炫酷的效果

  • layout_anchor:设置当前view 的锚点,我们熟悉的 PopupWindow 也有类似概念。
  • layout_anchorGravity:设置相对锚点的位置,如bottom|right表示 view位于锚点的右下角
  • layout_scrollFlags:滑动时,的联动标识,一般用来做联动的view,该view本身不支持联动事件
  • enterAlways:与 scroll 类似(scroll|enterAlways),只不过向下滚动先显示 AppBarLayout 到完全,再滚动 Scrolling View。
  • enterAlwaysCollapsed:需要和 enterAlways 一起使用(scroll|enterAlways|enterAlwaysCollapsed),和 enterAlways 不一样的是,不会显示 AppBarLayout 到完全再滚动 Scrolling View,而是先滚动 AppBarLayout 到最小高度,再滚动 Scrolling View,最后再滚动 AppBarLayout 到完全显示。
android:minHeight="10dp"
app:layout_scrollFlags="scroll|enterAlways|enterAlwaysCollapsed"
  • exitUntilCollapsed:顾名思义,定义了 AppBarLayout 消失的规则。发生向上滚动事件时,AppBarLayout 向上滚动退出直至最小高度(minHeight),然后 Scrolling View 开始滚动。也就是,AppBarLayout 不会完全退出屏幕
    注意:需要定义 View 的最小高度(minHeight)才有效果
android:minHeight="10dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
  •  
    scroll: 隐藏的时候,先整体向上滚动,直到 AppBarLayout 完全隐藏,再开始滚动 Scrolling View;显示的时候,直到 Scrolling View 顶部完全出现后,再开始滚动 AppBarLayout 到完全显示
     
     
  • app:layout_behavior:滑动view的行为。

CollapsingToolbarLayout:折叠效果


1.视觉差因子


app:layout_collapseParallaxMultiplier="0.5" 2.视觉差模式: app:layout_collapseMode="parallax"


parallax:视觉差

pin:

contentScrim:表示 CollapsingToolbarLayout 折叠之后的“前景色”

statusBarScrim:表示状态栏的“前景色”