
nestedParent:一个实现了NestedScrollingParent的父容器;
nestedChild:一个实现了NestedScrollingChild的子View;
[toc]
onStartNestedScroll
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes)
target: 发起嵌套滚动的子View,该子View必须实现NestedScrollingChild接口,该子View并不需要是当前View的直接子View
child:当前View中直接包含target的子View
当前nestedcChild想要进行嵌套滚动时,会调用nestedParent的这个方法,这个方法用来指示是否支持嵌套滚动;
只支持垂直方向上的嵌套
@Override
public boolean onStartNestedScroll(View child, View target, int nestedScrollAxes) {
if (nestedScrollAxes == ViewCompat.SCROLL_AXIS_VERTICAL) {
return true;
}
return false;
}
onNestedScrollAccepted
public void onNestedScrollAccepted(View child, View target, int axes)
onNestedScroll
public void onNestedScroll(View target, int dxConsumed, int dyConsumed,int dxUnconsumed, int dyUnconsumed);




近期评论