positionViewHolder{a1bbfa3 position=2 id=-1, oldPos=-1, pLpos:-1 no parent}

RecyclerView刷新数据时遇到此异常,Inconsistency detected. Invalid view holder adapter positionViewHolder{a1bbfa3 position=2 id=-1, oldPos=-1, pLpos:-1 no parent},网上查阅下说是原生bug,自定义了线性layout,重写

@Override

 
  
public void onLayoutChildren (RecyclerView.Recycler recycler , RecyclerView.State state) {
try {
super .onLayoutChildren(recycler , state) ;
} catch (IndexOutOfBoundsException e) {
e.printStackTrace() ;
}
}
,结果发现还是会报红,干脆在clear数据时,

recycler_user.removeAllViews();
就没遇到报的问题了

你可能感兴趣的:(positionViewHolder{a1bbfa3 position=2 id=-1, oldPos=-1, pLpos:-1 no parent})