You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DiscreteScrollLayoutManager.java
@Override
public void onItemsRemoved(RecyclerView recyclerView, int positionStart, int itemCount) {
int newPosition = currentPosition;
if (recyclerViewProxy.getItemCount() == 0) {
newPosition = NO_POSITION;
} else if (currentPosition >= positionStart) {
//if (currentPosition < positionStart + itemCount) {
if (currentPosition < itemCount) {
//If currentPosition is in the removed items, then the new item became current
currentPosition = NO_POSITION;
}
newPosition = Math.max(0, currentPosition - itemCount);
}
onNewPosition(newPosition);
}
I use the following Code in my RecyclerView.Adapter to remove an Item. If the current scroll-position is at the top, everything works fine.
If the scroll-position is somewhere in the middle of the List, the List automatically scrolls to the Top of the View.
How to avoid this behaviour?
notifyItemRemoved(position); if (position != dataList.size()) { notifyItemRangeChanged(position, dataList.size() - position); }
The text was updated successfully, but these errors were encountered: