项目出现java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid view holder adapter positionViewHoldebug。查看代码无果,stackoverflow上推荐的解决的办法是:
public class WrapContentLinearLayoutManager extends LinearLayoutManager {
public WrapContentLinearLayoutManager(Context context) {
super(context);
}
@Override
public void onLayoutChildren(RecyclerView.Recycler recycler, RecyclerView.State state) {
try {
super.onLayoutChildren(recycler, state);
} catch (IndexOutOfBoundsException e) {
Log.e("probe", "meet a IOOBE in RecyclerView");
}
}
}