1. 程式人生 > >RecyclerView 的IndexOutOfBoundsException: Inconsistency detected異常解決辦法

RecyclerView 的IndexOutOfBoundsException: Inconsistency detected異常解決辦法

在使用RecyclerView 的時候用到側滑刪除,出現了下面的異常:

這裡寫圖片描述

經查閱資料,發現在介面卡中使用notifyItemRemoved,notifyItemChanged 方法導致的,這裡主要在刪除時錯誤的呼叫了 notifyItemChanged 方法所致,改為 notifyItemRemoved 即可解決。

以上僅是我在使用時遇到的問題,更多錯誤內容可以以查閱 android issu158046.