Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i load more data,between last data of refresh and first data of loadmore has no divider,then i scroll the recycleview ,then divider has show,why #60

Open
wei7785929 opened this issue Sep 4, 2018 · 1 comment

Comments

@wei7785929
Copy link

No description provided.

@wangxue
Copy link

wangxue commented Oct 24, 2019

RecyclerView-FlexibleDivider builder set showLastDivider to false by default,so the last item will have no divider. When app load more data, you called notifyItemRangedInserted and the item which has no divider will not be invalidated.

to fix the problem, here is my suggestions:

  1. call notifyDatasetChanged when load more data to ensure all items are invalidated
  2. build divider with showLastDivider
    new HorizontalDividerItemDecoration.Builder(this).showLastDivider().build());
  3. call notifyItemChanged() to invalidate the item which has no divider
    final int last = adapter.getItemCount() - 1;
    // adaper.notifyItemRangeInserted(last, list.size());
    adapter.notifyItemChanged(last);

select one you prefer, i suggest the third one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants