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

itemProvider中绑定数据的疑问 #50

Closed
Dragon-Boat opened this issue Dec 23, 2016 · 1 comment
Closed

itemProvider中绑定数据的疑问 #50

Dragon-Boat opened this issue Dec 23, 2016 · 1 comment

Comments

@Dragon-Boat
Copy link

itemProvider中,onBindViewHolder中提供了当前viewholder和相关的数据类,但是我想访问上一个位置的数据,应该如何做? 问题抽象一下,就是当前item的不仅和自身状态有关,也和上一个item的数据有联系。

@drakeet
Copy link
Owner

drakeet commented Dec 23, 2016

那你可以把 items List 通过 provider 构造函数或 setter 方法传给 provider 即可,provider 中可以拿到 position,再调用例如 items.get(getPosition() - 1)

@drakeet drakeet closed this as completed Dec 23, 2016
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