Android 解决Recycler View: Inconsistency detected.

Recycler View: Inconsistency detected. Invalid view holder adapter positionViewHolder
这是android的一个已知bug,可以通过try-catch解决,没有副作用

public class WrapContentLinearLayoutManager extends LinearLayoutManager {
    //... constructor
    @Override
    public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
        try {
            super.onLayoutChildren(recycler, state);
        } catch (IndexOutOfBoundsException e) {
            Log.e("Error", "IndexOutOfBoundsException in RecyclerView happens");
        }
    }
}
上一篇:WPF 3D中多个模型如何设置某一个在最前?


下一篇:springMVC4(11)使用注解完成数据格式化