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

你好,在Recyclerview里用这个会出现多次setOnLabelSelectChangeListener回调 #36

Open
FangXiaoyang opened this issue Oct 23, 2019 · 2 comments

Comments

@FangXiaoyang
Copy link

在Recyclerview里用这个,会出现多次回调,选中第一个后往上滑,再回来的时候label已经取消了显示状态。

@donkingliang
Copy link
Owner

是的,在Recyclerview中使用LabelsView,需要自己去保存和恢复LabelsView的选择项,否则在item复用时会显示错误。而在item复用时恢复选中项,会回调OnLabelSelectChangeListener。
你需要自己管理和恢复选中的项。在设置labels和恢复选中项前,先setOnLabelSelectChangeListener(null)把监听器置空。设置和恢复数据后再重新设置监听器。
这个就跟在Recyclerview中使用EditText需要自己保存和恢复输入的文本是一样的道理,可以参考这个来处理你的问题。

@FangXiaoyang
Copy link
Author

谢谢,才看到邮件,我把他的selectType设置了成了none,然后在setLabels里用了自己的数据tag去做判断。

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