CymChad / CymChad/BaseRecyclerViewAdapterHelper
3.0.2版本 会出现这个问题 请求接口 加载数据 加载完后 会出现 调用: mAdapter?.removeAllHeaderView() addHeadView()
Nobody has claimed this yet.
- Dominant language
- Kotlin
- Stars
- 24.6k
- Forks
- 5.2k
- PR merge metrics
- No merged PRs in 30d
Description
java.lang.IllegalArgumentException: Called attach on a child which is not detached: ViewHolder{2b96bb5 position=0 id=-1, oldPos=-1, pLpos:-1} androidx.recyclerview.widget.RecyclerView{ac2324a VFED..... .F....ID 0,0-1080,1491 #7f09081e app:id/rv}, adapter:com.addcn.android.rent.house.RentHouseListAdapter@f3e25bb, layout:androidx.recyclerview.widget.LinearLayoutManager@6973ad8, context:com.addcn.android.rent.housenew.house.NewRentHouseActivity@bd76552
at androidx.recyclerview.widget.RecyclerView$5.attachViewToParent(RecyclerView.java:915)
at androidx.recyclerview.widget.ChildHelper.attachViewToParent(ChildHelper.java:239)
at androidx.recyclerview.widget.RecyclerView.addAnimatingView(RecyclerView.java:1431)
at androidx.recyclerview.widget.RecyclerView.animateDisappearance(RecyclerView.java:4161)
at androidx.recyclerview.widget.RecyclerView$4.processDisappeared(RecyclerView.java:612)
at androidx.recyclerview.widget.ViewInfoStore.process(ViewInfoStore.java:240)
at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3994)
at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:3652)
at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4194)
at android.view.View.layout(View.java:17637)
at android.view.ViewGroup.layout(ViewGroup.java:5602)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1741)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1585)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1494)
at android.view.View.layout(View.java:17637)
at android.view.ViewGroup.layout(ViewGroup.java:5602)
at com.scwang.smartrefresh.layout.SmartRefreshLayout.onLayout(SmartRefreshLayout.java:645)
at android.view.View.layout(View.java:17637)
at android.view.ViewGroup.layout(ViewGroup.java:5602)
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
Reproduce the reported sequence in RentHouseListAdapter: load the interface data, call removeAllHeaderView(), then addHeadView(). Start by tracing the RecyclerView attach and layout stack, especially animateDisappearance and SmartRefreshLayout.onLayout, and confirm the fix prevents the IllegalArgumentException during header changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, kotlin
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100