Material Design-CoordinatorLayout
来源:互联网 发布:东莞广电网络多少兆 编辑:程序博客网 时间:2024/06/05 07:00
协调布局作为一个 容器与一个或者多个子View进行交互,一般在最上层,协调布局可以控制子view之间相互协作
设置锚点
将view定位到锚点view
app:layout_anchor="@id/xxx"
锚点位置
值有 bottom、center、right、left、top
app:layout_anchorGravity
设置行为
app:layout_behavior
默认的行为有:滚动行为,通过字符串资源引用
@string/appbar_scrolling_view_behavior
app:layout_behavior="@string/appbar_scrolling_view_behavior"
beihavior的自定义
参考:
http://blog.csdn.net/briblue/article/details/73076458
1、确定 CoordinatorLayout 中 View 与 View 之间的依赖关系,通过 layoutDependsOn() 方法,返回值为 true 则依赖,否则不依赖。
2、当一个被依赖项 dependency 尺寸或者位置发生变化时,依赖方会通过 Byhavior 获取到,然后在 onDependentViewChanged 中处理。如果在这个方法中 child 尺寸或者位置发生了变化,则需要 return true。
3、当 Behavior 中的 View 准备响应嵌套滑动时,它不需要通过 layoutDependsOn() 来进行依赖绑定。只需要在 onStartNestedScroll() 方法中通过返回值告知 ViewParent,它是否对嵌套滑动感兴趣。返回值为 true 时,后续的滑动事件才能被响应。同时在onNestedPreScroll处理滑动的后续变化
4、嵌套滑动包括滑动(scroll) 和 快速滑动(fling) 两种情况。开发者根据实际情况运用就好了。 Behavior 通过 3 种方式绑定:1. xml 布局文件。2. 代码设置 layoutparam。3. 自定义 View 的注解。
5、需要实现xml中引用需要实现两个参数的构造MyBehavior(context: Context,attributeSet: AttributeSet)否则会爆错
- Material Design CoordinatorLayout
- Coordinatorlayout---Material Design风格
- Material Design-CoordinatorLayout
- Material Design:CoordinatorLayout,CollapsingToolbarLayout,AppBarLayou
- Material Design之CoordinatorLayout CollapsingToolbarLayout
- 谈谈Material Design之CoordinatorLayout
- Android Material Design之CoordinatorLayout
- 【Material Design】CoordinatorLayout使用介绍
- Material Design学习之CoordinatorLayout
- Material Design-UI之CoordinatorLayout
- Android Material Design之CoordinatorLayout
- Android Material Design 之 CoordinatorLayout
- Android Material Design CoordinatorLayout使用
- Material Design控件之CoordinatorLayout
- Android Material Design:CoordinatorLayout与NestedScrollView
- Android material Design 之CoordinatorLayout详解
- Material Design Library系列之CoordinatorLayout
- Material Design学习:CoordinatorLayout+AppBarLayout+CollapsingToolbarLayout
- git client 配置以及连接GitHub、Bitbucket
- 【备忘】Java菜鸟到大牛学习路线之实战篇
- 机器学习算法与Python实践(9)
- jvm性能分析参数
- Effective Java
- Material Design-CoordinatorLayout
- 《算法艺术与信息学竞赛》之 递归与分治法 例二 三色多边形
- Hibernate入门学习(3)----第一个Hibernate例子
- 商品发布的复杂逻辑
- Python内存管理机制
- Weblogic 性能调优
- Linux 学习 (五) DNS配置
- SOI模型
- 祝贺! 61人新当选为中科院院士! 外籍院士中有2名诺贝尔奖获得者