Skip to content Skip to sidebar Skip to footer

Scrolling Recyclerview Manually Does Not Update Coordinatorlayout , While Scrolling By Touch It Update Coordinatorlayout

Solution 1:

You could put

    appBarLayout.setExpanded(false);

before you do scrollToPositionWithOffset

Solution 2:

CoordinatorLayout.Behaviour is works with only NestedScroll event. When you try to scroll RecyclerView programmatically it is treat as normal scroll.

Write below line to inform RecyclerView start NesteadScroll, With ViewCompat.SCROLL_AXIS_VERTICAL and ViewCompat.TYPE_NON_TOUCH

ViewCompat.SCROLL_AXIS_VERTICAL: Indicates scrolling along the vertical axis. ViewCompat.TYPE_NON_TOUCH: Indicates that the input type for the gesture is caused by something which is not a user touching a screen. This is usually from a fling which is settling.

recycler_view.startNestedScroll(ViewCompat.SCROLL_AXIS_VERTICAL, ViewCompat.TYPE_NON_TOUCH)
recycler_view.smoothScrollBy(0,200)

Post a Comment for "Scrolling Recyclerview Manually Does Not Update Coordinatorlayout , While Scrolling By Touch It Update Coordinatorlayout"