NestedScrollingParent 和NestedScrollingChild
来源:互联网 发布:金俊用的什么软件 编辑:程序博客网 时间:2024/05/22 00:00
在5.0以上 有些滑动view实现了NestedScrollingParent 和NestedScrollingChild
CoordinatorLayout
里面的LayoutParams 有着一个mBehavior以下是CoordinatorLayout 源码一部分
@Overridepublic void onNestedPreScroll(View target, int dx, int dy, int[] consumed) { int xConsumed = 0; int yConsumed = 0; boolean accepted = false; final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { final View view = getChildAt(i); if (view.getVisibility() == GONE) { // If the child is GONE, skip... continue; } //这个LayoutParams是CoordinatorLayout.layoutparams final LayoutParams lp = (LayoutParams) view.getLayoutParams(); if (!lp.isNestedScrollAccepted()) { continue; } final Behavior viewBehavior = lp.getBehavior(); if (viewBehavior != null) { mTempIntPair[0] = mTempIntPair[1] = 0;//滑动的回调 viewBehavior.onNestedPreScroll(this, view, target, dx, dy, mTempIntPair); xConsumed = dx > 0 ? Math.max(xConsumed, mTempIntPair[0]) : Math.min(xConsumed, mTempIntPair[0]); yConsumed = dy > 0 ? Math.max(yConsumed, mTempIntPair[1]) : Math.min(yConsumed, mTempIntPair[1]); accepted = true; } } consumed[0] = xConsumed; consumed[1] = yConsumed; if (accepted) { onChildViewsChanged(EVENT_NESTED_SCROLL); }}也就是说 在滑动的时候多了一些不同状态下的滑动
https://segmentfault.com/a/1190000002873657
https://race604.com/flyrefresh/
https://race604.com/android-nested-scrolling/
http://blog.csdn.net/feizhixuan46789/article/details/50520197
http://blog.csdn.net/diaotai/article/details/52217077
http://www.jianshu.com/p/ed2852eff92e
https://www.zhihu.com/question/27775923
0 0
- NestedScrollingChild和NestedScrollingParent
- NestedScrollingParent 和NestedScrollingChild
- Android中的NestedScrollingParent和NestedScrollingChild分析
- Android中的NestedScrollingParent和NestedScrollingChild分析
- NestedScrollingParent, NestedScrollingChild 详解
- NestedScrollingParent, NestedScrollingChild 详解
- NestedScrollingParent, NestedScrollingChild 详解
- NestedScrollingParent, NestedScrollingChild 详解
- NestedScrollingChild NestedScrollingParent API的粗略中文解释
- 从NestedScrollingChild、NestedScrollingParent源码分析嵌套滑动机制
- Android-NestedScrollingParent, NestedScrollingChild父子View 间 的 嵌套滑动
- 实现嵌套滑动——NestedScrollingParent与NestedScrollingChild接口及其实现
- NestedScrollingParent
- WebView 实现 NestedScrollingChild
- 仿NestedScrollingParent嵌套滑动
- RecyclerView的NestedScrollingParent
- Android 自定义WebView 实现 NestedScrollingChild
- Android 自定义WebView 实现 NestedScrollingChild
- 跟小博老师一起学习数据库 ——JDBC-下篇
- linux环境下 mysql数据库忘记密码 处理办法
- 'Application windows are expected to have a root view controller at the end of application launch'
- linux环境下安装jdk(本文示例是jdk1.6.0_45)
- redis的安装和测试
- NestedScrollingParent 和NestedScrollingChild
- Linux中fork函数分析
- JS判断值是否是数字
- Java匿名内部类使用与示例
- 【LeetCode】7. Reverse Integer
- android 使文字向左或者向右倾斜
- uva Fewest Flops(dp)@
- 【51Nod】1001 数组中和等于K的数对
- Spring中的@Controller注解和@RestController注解的相同点和不同点