下面列出了android.support.v4.view.ViewCompat#ScrollAxis ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public boolean startNestedScroll(@ViewCompat.ScrollAxis int axes) {
return startNestedScroll(axes, TYPE_TOUCH);
}
/**
* 询问父控件是否处理嵌套滑动的方法。
* 当某个继承NestedScrollingChild接口的孩子(包括直接孩子和间接孩子)
* 通过startNestedScroll发起一个嵌套滑动事件后会调用到该方法,询问父控件是否接受嵌套滑动。
* @param child:父控件的一个直接孩子,child可能是target也可能是target的父亲(不一定是直接父亲)。
* @param target:发起嵌套滑动事件的控件。也就是调用startNestedScroll方法的view
* @param axes :嵌套滑动方向,包括水平和竖直或都有
* @return :返回true接受。
*/
boolean onStartNestedScroll(@NonNull View child, @NonNull View target, @ViewCompat.ScrollAxis int axes);
/**
* onStartNestedScroll返回true会调用该方法,表示父控件接受嵌套滑动。
* 它给父控件一个时机去初始化一些为了嵌套滑动做准备的配置
* @param child:父控件的一个直接孩子,child可能是target也可能是target的父亲(不一定是直接父亲)。
* @param target:发起嵌套滑动事件的控件。也就是调用startNestedScroll方法的view
* @param axes :嵌套滑动方向,包括水平和竖直或都有
*/
void onNestedScrollAccepted(@NonNull View child, @NonNull View target, @ViewCompat.ScrollAxis int axes);
/**
* Return the current axes of nested scrolling for this NestedScrollingParent.
*
* <p>A NestedScrollingParent returning something other than {@link ViewCompat#SCROLL_AXIS_NONE}
* is currently acting as a nested scrolling parent for one or more descendant views in
* the hierarchy.</p>
*
* @return Flags indicating the current axes of nested scrolling
* @see ViewCompat#SCROLL_AXIS_HORIZONTAL
* @see ViewCompat#SCROLL_AXIS_VERTICAL
* @see ViewCompat#SCROLL_AXIS_NONE
*/
@ViewCompat.ScrollAxis
int getNestedScrollAxes();
/**
* 开始嵌套滑动,一般在down事件触发
* @param axes:嵌套滑动方向
* @return
*/
boolean startNestedScroll(@ViewCompat.ScrollAxis int axes);