-
Notifications
You must be signed in to change notification settings - Fork 752
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
getPosition() 方法不能获得正确的 Position #57
Labels
Comments
请贴出你的相关代码。 |
感谢反馈,这确实是一个 BUG!getPosition() 如果没有马上消费,确实会存在被新的 item 绑定上新的位置导致旧的 item view provider getPosition() 不正常。建议先用 holder.getAdapterPosition() 替代,抱歉! |
drakeet
added a commit
that referenced
this issue
Jan 7, 2017
drakeet
added a commit
that referenced
this issue
Jan 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Q: 如何在 ItemViewProvider 中获取到 item position? A: 从 v2.3.0 版本开始,只需要在你的 ItemViewProvider 子类里调用 getPosition() 方法即可。如果低于 v2.3.0 版本,可以调用 holder.getAdapterPosition() 获得同样结果。
在我使用 v2.3.4 时发现,他们俩并不一致
onClick: ===AdapterPosition:0===Position:1
onClick: ===AdapterPosition:1===Position:1
onClick: ===AdapterPosition:2===Position:2
onClick: ===AdapterPosition:3===Position:3
onClick: ===AdapterPosition:4===Position:4
onClick: ===AdapterPosition:5===Position:5
onClick: ===AdapterPosition:0===Position:0
onClick: ===AdapterPosition:1===Position:0
onClick: ===AdapterPosition:2===Position:0
onClick: ===AdapterPosition:2===Position:0
onClick: ===AdapterPosition:3===Position:3
onClick: ===AdapterPosition:3===Position:3
onClick: ===AdapterPosition:21===Position:22
onClick: ===AdapterPosition:22===Position:22
onClick: ===AdapterPosition:22===Position:22
onClick: ===AdapterPosition:23===Position:24
onClick: ===AdapterPosition:23===Position:24
这是我随手打印的日志
The text was updated successfully, but these errors were encountered: