-
Notifications
You must be signed in to change notification settings - Fork 329
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
动态添加一条数据,更新后item没有间距 #457
Comments
notifyItemInserted局部刷新不行,notifyDataSetChanged()没问题 |
notifyItemInserted() 仅通知插入新项而不是重新计算所有 Item 的布局你是通过 ItemDecoration 来设置间距的它可能没有触发重新计算所有项的布局导致新插入的项没有应用到 ItemDecoration 的间距规则,你可以使用notifyDataSetChanged来解决问题这个并不是框架的问题 |
也就是必须得刷新全部才能绘制间距-------- 原始邮件 --------发件人: Ghn ***@***.***>日期: 2024年9月13日周五 13:31收件人: liangjingkanji/BRV ***@***.***>抄送: leexing ***@***.***>, Author ***@***.***>主 题: Re: [liangjingkanji/BRV] 动态添加一条数据,更新后item没有间距 (Issue #457)
notifyItemInserted() 仅通知插入新项而不是重新计算所有 Item 的布局你是通过 ItemDecoration 来设置间距的它可能没有触发重新计算所有项的布局导致新插入的项没有应用到 ItemDecoration 的间距规则,你可以使用notifyDataSetChanged来解决问题这个并不是框架的问题
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: ***@***.***>
|
这属于RecyclerView知识, BRV并未自定义RecycleView, 和本框架关系不大 考虑到可能其他人也会遇到还是同步到BRV文档下 通知更新 @Gao-hao-nan 他说的分析内容很正确, 或者你也可以尝试使用 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
第一次加载的数据,有间距。向列表中动态添加一条数据后,列表数据更新后,没有间距
期望结果
更新后,有间距
如何复现
rcv.mutable.add(bean)
rcv.bindingAdapter.notifyItemInserted(list.size - 1)
截图
异常堆栈信息或者手机截图/视频(拖拽到输入框即可上传)
版本
The text was updated successfully, but these errors were encountered: