Item positions are shifted with each update
jurgen178 opened this issue · comments
Hi there, displayed items are shifted to the right bottom side each time the view is updated.
When data is updated in a loop using
recyclerView.addItemDecoration(getSectionCallback(dataList))
the display items have the correct position during the first iteration, but start to shift to the right/bottom with each iteration.
As a test, setting the defaultOffset to 0 stops the shifting, so it seems an offset accumulates each time.
private var defaultOffset: Int = 0.DP(context).toInt()
There is nothing wrong with the timeline code itself. The problem seems to be the accumulated item decorations of the underlying recyclerview. The problem resolves if all existing items decorations are removed before the new item decoration is added.
Maybe you could add this to the example code?
for (i in 0 until recyclerView.itemDecorationCount) {
recyclerView.removeItemDecorationAt(0)
}