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
notifyItemRemoved删除存在分割线的staggered瀑布流崩溃 #157
Comments
你有删除models里面的数据吗? |
onClick(R.id.delete) {
val model = getModel<ChannelItem>()
rv?.mutable?.remove(model)
this.bindingAdapter?.notifyItemRemoved(modelPosition)
} 我是这样调用的 |
你是不是添加了Header, 这会导致modelPosition无法对应真实位置 |
没有添加 |
|
bd.rv.staggered(2)
.divider {
setDrawable(R.drawable.divider_horizontal)
orientation = DividerOrientation.GRID
startVisible = true
} |
你就不能用代码块包裹代码吗? 你这可读性太差 |
我换成layoutPosition也是一样的崩溃诶 |
这个问题不是很好复现, 你能否fork仓库在demo中复现该崩溃. 利于加快解决速度 |
好,我一会把完整的代码拷过去,那我如果只是想删除item并更新需要怎么操作 |
虽然你代码写的啰嗦了但是的确是这么写的 R.id.delete.onClick {
mutable.removeAt(layoutPosition) // 鉴于我怕你models里面塞得数据类有相同的就不使用mutable.remove(getModel())
notifyItemRemoved(layoutPosition)
} 虽然这个说法可能有点侮辱你, 但是 |
我使用你给的这个删除还是崩了.... |
我把瀑布流换成grid就不会崩了 |
使用 R.id.delete.onClick {
mutable.removeAt(layoutPosition)
notifyDataSetChanged()
} 该问题已修复请等待新版本发布 |
如何了? |
我现在先用grid没问题 |
grid可以替代staggered? 我问题已经修复了, 使用notifyDataSetChanged或者notifyItemRemoved都可以 |
不能替代,但是我们那个列表可以不使用瀑布流,因为item高度一样的,我更新到你的最新版本 |
删除item时调用bindingAdapter?.notifyItemRemoved(modelPosition)产生的
The text was updated successfully, but these errors were encountered: