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

偶现 返回的postion为-1 #272

Open
weiweiForAndroid opened this issue May 15, 2018 · 1 comment
Open

偶现 返回的postion为-1 #272

weiweiForAndroid opened this issue May 15, 2018 · 1 comment

Comments

@weiweiForAndroid
Copy link

java.lang.ArrayIndexOutOfBoundsException: length=20; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at com.jude.easyrecyclerview.adapter.RecyclerArrayAdapter.getItem(RecyclerArrayAdapter.java:667)

if (mItemClickListener!=null) {
viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
@OverRide
public void onClick(View v) {
mItemClickListener.onItemClick(viewHolder.getAdapterPosition()-headers.size());
}
});
}

返回的postion为-1

@lijunhuayc
Copy link

public void onClick(View v) {
mItemClickListener.onItemClick(viewHolder.getAdapterPosition()-headers.size());
}
});
}
这里应该使用viewHolder.getLayoutPosition()吧

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