在RecyclerView.java上崩溃:5421 validateViewHolderForOffsetPosition

时间:2018-10-03 03:26:38

标签: android android-recyclerview nestedrecyclerview

帮助我如何处理此崩溃,在这个rec​​yclerview上,我在其中使用适配器,并且在positionViewHolder position = 111 id = -1,oldPos = 110,pLpos:110

的滚动功能中,我使用NestedScrollView
android.support.v7.widget.RecyclerView$Recycler.validateViewHolderForOffsetPosition (RecyclerView.java:5421)
android.support.v7.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline (RecyclerView.java:5603)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5563)
android.support.v7.widget.RecyclerView$Recycler.getViewForPosition (RecyclerView.java:5559)
android.support.v7.widget.LinearLayoutManager$LayoutState.next (LinearLayoutManager.java:2229)
android.support.v7.widget.LinearLayoutManager.layoutChunk (LinearLayoutManager.java:1556)
android.support.v7.widget.LinearLayoutManager.fill (LinearLayoutManager.java:1516)
android.support.v7.widget.LinearLayoutManager.onLayoutChildren (LinearLayoutManager.java:608)
android.support.v7.widget.RecyclerView.dispatchLayoutStep1 (RecyclerView.java:3644)
android.support.v7.widget.RecyclerView.onMeasure (RecyclerView.java:3103)
android.view.View.measure (View.java:21051)
android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:715)
android.widget.RelativeLayout.onMeasure (RelativeLayout.java:461)
android.view.View.measure (View.java:21051)
android.widget.RelativeLayout.measureChildHorizontal (RelativeLayout.java:715)
android.widget.RelativeLayout.onMeasure (RelativeLayout.java:461)
android.view.View.measure (View.java:21051)
android.support.v4.widget.NestedScrollView.measureChildWithMargins (NestedScrollView.java:1449)
android.widget.FrameLayout.onMeasure (FrameLayout.java:185)
android.support.v4.widget.NestedScrollView.onMeasure (NestedScrollView.java:515)
android.view.View.measure (View.java:21051)

1 个答案:

答案 0 :(得分:0)

如果可以发布适配器实际代码,将很有帮助。回收商视图中不需要嵌套的滚动视图,但是我建议您确保项目的高度/数量正确。