Android - RecyclerView add item to firstPosition

时间:2016-07-11 19:23:53

标签: android android-recyclerview

I'm using RecyclerViewPager. On OnPageChangedListener in onPageChanged I'm adding item to the left or to the right depending to the swipe direction.

public void addLeft() {

    int index = dataSet.size() - 1;

    dataSet.remove(index);
    notifyItemRemoved(index);

    dataSet.add(0, new Data());
    notifyItemInserted(0);
}

The thing is, I can scroll to the left to infinity, but onBindViewHolder is not called, even when calling notifyItemInserted. Could you tell me what could help? Thanks.

1 个答案:

答案 0 :(得分:0)

I have found a solution setHasStableIds(false)