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

remove方法不对,应该notifyItemRangeChanged() 一次,要不会删除条目错乱; #862

Closed
AceInAndroid opened this issue Mar 14, 2017 · 4 comments

Comments

@AceInAndroid
Copy link

现在的remove方法是

public void remove(int position) {
    mData.remove(position);
    notifyItemRemoved(position + getHeaderLayoutCount());
    compatibilityDataSizeChanged(0);
}

应该再告诉adapter数据源更新 要不条目会错乱
notifyItemRangeChanged(position, data.size() - position);

@CymChad
Copy link
Owner

CymChad commented Mar 14, 2017

@AceInAndroid 感谢提醒,后续会进行改进。

@AceInAndroid
Copy link
Author

AceInAndroid commented Mar 15, 2017

嘻嘻,写的很好的,节省了很多的代码,就是项目频繁要删除添加item,不通知后面的条目更新位置的话,都会错乱的,当然 如果删除的是最后一条也不用通知,insert方法也是~也要notifyItemRangeChanged

@CymChad
Copy link
Owner

CymChad commented Mar 20, 2017

compile 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.8.9'

@zhaohailongzhl
Copy link

请问这个解决了吗,我现在的的版本是2.9.30,多次删除还是会出现条目错乱的问题

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

3 participants