4

onNestedFling or onNestedPreFling behavior callbacks aren't triggered for NestedScrollView inside CoordinatorLayout when flinging in upward direction. However, when I fling in downward direction, they're triggered. Any known issue?

The above callbacks are triggered when I replace NestedScrollView with RecyclerView.

Just for clarification, custom behavior class is:

public class DummyBehavior extends CoordinatorLayout.Behavior<View> {
    public DummyBehavior() {
    }

    public DummyBehavior(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public boolean onStartNestedScroll(CoordinatorLayout coordinatorLayout, View child, View directTargetChild, View target, int nestedScrollAxes) {
        Log.i("onStartNestedScroll", "true");
        return true;
    }

    @Override
    public boolean onNestedPreFling(CoordinatorLayout coordinatorLayout, View child, View target, float velocityX, float velocityY) {
        Log.i("onNestedPreFling", "true");
        return super.onNestedPreFling(coordinatorLayout, child, target, velocityX, velocityY);
    }

    @Override
    public boolean onNestedFling(CoordinatorLayout coordinatorLayout, View child, View target, float velocityX, float velocityY, boolean consumed) {
        Log.i("onNestedFling", "true");
        return super.onNestedFling(coordinatorLayout, child, target, velocityX, velocityY, consumed);
    }
}

Log.i("onNestedFling", "true"); and Log.i("onNestedPreFling", "true"); are logged only in case of flings in RecyclerView.

And they're only logged on downward flings in case of NestedScrollView (not upward flings).

ArunL
  • 350
  • 2
  • 14

0 Answers0