Inconsistency detected in RecyclerView, How to change contents of RecyclerView while scrolling

前端 未结 26 2497
借酒劲吻你
借酒劲吻你 2020-12-01 00:59

I\'m using RecyclerView to display name of the items. My row contains single TextView. Item names are stored in List mItemList<

26条回答
  •  天命终不由人
    2020-12-01 01:47

    Just prohibit RecyclerView's scroll when data is changing.

    Like as my code:

    mRecyclerView.setOnTouchListener(
            new View.OnTouchListener() {
                @Override
                public boolean onTouch(View v, MotionEvent event) {
                    if (mIsRefreshing) {
                        return true;
                    } else {
                        return false;
                    }
                }
            }
    );
    

    More about: http://drakeet.me/recyclerview-bug-indexoutofboundsexception-inconsistency-detected-invalid-item-position-solution

提交回复
热议问题