RecyclerView如何使用正确notifyItemRemo
作者:
不识水的鱼 | 来源:发表于
2017-07-14 15:10 被阅读607次关于RecyclerView
如何使用正确notifyItemRemoved
,有一些坑必须要填,直接调用
data.remove(posiiton);
notifyItemRemoved(position);
position的位置回错乱, onBindViewHolder
不会调用,所以必须加上notifyItemRangeChanged
才行
public void removeItem(int position){
data.remove(posiiton);
notifyItemRemoved(position);
notifyItemRangeChanged(position, data.size() - position);
}
@Override
public void onStart() {
super.onStart();
Window window = getDialog().getWindow();
WindowManager.LayoutParams windowParams = window.getAttributes();
windowParams.dimAmount = 0.0f;
windowParams.flags |= WindowManager.LayoutParams.FLAG_DIM_BEHIND;
window.setAttributes(windowParams);
}
本文标题:RecyclerView如何使用正确notifyItemRemo
本文链接:https://www.haomeiwen.com/subject/dojyqxtx.html
网友评论