CymChad / CymChad/BaseRecyclerViewAdapterHelper
在使用removeAllHeaderView和addHeaderView的时候报错
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
如题 我使用了以后 报错:Cannot call this method while RecyclerView is computing a layout or scrolling androidx.recyclerview.widget.RecyclerView
然后我的代码块是这样的
if (bookListBeen.size()>0){
//如果本地有书单则显示
View headView = getHeaderView(new NewBookCollectionBean.DataBean(),bookListBeen);
mAdapter.removeAllHeaderView();
mAdapter.addHeaderView(headView);
}
mAdapter.setNewData(mBeen);
rv.setAdapter(mAdapter);
我的数据是一个接口返回两个不同的list和一个object,一个list作为列表,另外一个list和object作为header的数据做处理
求解答 很急 谢谢
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 by reproducing the reported sequence using removeAllHeaderView(), addHeaderView(), setNewData(), and rv.setAdapter(), then inspect how these calls interact with RecyclerView's layout state. Done means the header and list data are updated without the reported RecyclerView exception.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100