我滚动RecyclerView在这段代码上遇到问题
来自RecyclerView.Adapter的这个
return items.get(position) != null ? VIEW_ITEM : VIEW_PROG;
这个来自活动
lLayout = new GridLayoutManager(MyActivity.this, 2);
rView.setVisibility(View.VISIBLE);
rView.setHasFixedSize(true);
rView.setLayoutManager(lLayout);
lLayout.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
switch(rcAdapter.getItemViewType(position)){
case RecyclerViewAdapter.VIEW_ITEM:
return 1;
case RecyclerViewAdapter.VIEW_PROG:
return 2;
default:
return -1;
}
}
});
得到例外:
java.lang.IndexOutOfBoundsException:索引49无效,大小为0 java.lang.IndexOutOfBoundsException:Index:0,Size:0
帮我解决这个问题 谢谢