Closed longxuewei closed 1 year ago
如果你也遇到了这个问题,那大概是刷新Adapter的时候没有加上 Adapter 的 Header 数量 以及 EmptyView 数量。所以出现这种情况只需要像这样:
mAdapter.notifyItemRangeChanged(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)
mAdapter.notifyItemRangeInserted(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)
mAdapter.notifyItemRangeRemoved(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)
如果你也遇到了这个问题,那大概是刷新Adapter的时候没有加上 Adapter 的 Header 数量 以及 EmptyView 数量。所以出现这种情况只需要像这样:
mAdapter.notifyItemRangeChanged(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)
mAdapter.notifyItemRangeInserted(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)
mAdapter.notifyItemRangeRemoved(positionStart + mAdapter.headerLayoutCount + if (mAdapter.hasEmptyView()) 1 else 0, itemCount)