-
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
Consider: Do we need position? #36
Comments
My conclusion is: No. If an And if you really need a position param, my suggestion is that: You can extend |
Chinese version: 我觉得是不需要,首先几乎所有需要 position 的需求,都可以 以不需要 position 的方式实现;其次,position 造成了耦合、对外依赖;而且,因为我们的 Items 容器中可能有多种类型的 items,如果直接取在 Items 中的位置,这是没有意义的,我们需要的是它们在同类中的位置;最后,如果你实在需要 position,完全可以通过继承源码来实现,MultiType 几乎所有的部件都是可拓展可替换的,我们不应该直接去修改源码。 |
最终,在 2.3.0 加入了获取 position 接口方法:
/**
* Get the adapter position of current item,
* the internal position is equals RecyclerView.ViewHolder#getAdapterPosition().
*
* @return the adapter position
* @since v2.3.0
*/
protected final int getPosition() {
return position;
} |
As the issue #35 request, I began to think about this issue, a position may be more convenient.
The text was updated successfully, but these errors were encountered: