CymChad / CymChad/BaseRecyclerViewAdapterHelper
添加Header时无法和ConcatAdapter配合使用
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
尝试了几次,没有添加Header和其它Adapter无异,当addHeaderView后出现异常,数组越界。
java.lang.ArrayIndexOutOfBoundsException: length=0; index=-1
at java.util.ArrayList.get(ArrayList.java:439)
at com.chad.library.adapter.base.BaseQuickAdapter.getItem(BaseQuickAdapter.java:604)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.java:931)
at com.chad.library.adapter.base.BaseQuickAdapter.onBindViewHolder(BaseQuickAdapter.java:68)
at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254)
at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337)
at androidx.recyclerview.widget.NestedAdapterWrapper.onBindViewHolder(NestedAdapterWrapper.java:157)
at androidx.recyclerview.widget.ConcatAdapterController.onBindViewHolder(ConcatAdapterController.java:368)
at androidx.recyclerview.widget.ConcatAdapter.onBindViewHolder(ConcatAdapter.java:188)
是和ConcatAdapter的兼容性问题
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with BaseQuickAdapter.getItem and onBindViewHolder, then reproduce the reported ArrayIndexOutOfBoundsException when addHeaderView is used with AndroidX ConcatAdapter. Compare the adapter position handling shown in the stack trace and verify that the same setup binds without an exception once fixed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100