This is what noticed: When it starts, the data item index 0, 1, ..., 5 are displayed in the view. And saw the onCreateViewHolder() and onBindViewHolder() got called for them. Then scroll out the top item, and saw the the onCreateViewHolder() and onBindViewHolder() got called for the index 6. Then scroll down to bring back the item index 0 into view. Since it was not recycled so no onBindViewHolder() is called.
This is by design, but having a case would like the onBindViewHolder to be called.
When item index 0 is out the view, and clicking on any item in the view would like to change the item index 0's data. When it is scroll back into the view would like to show the data's change. But since its onBindView is not called, the data change of this row is not updated in UI.
It could call
notifyDataSetChanged()
after the data change to force redraw the list. But the result is not good because there is image on the view item and shows flickering.
tried use LayoutManager to get whatever is the view to force update. The problem is when is best time to know that index 0 is showing up in the LayoutManager's children view?
Any suggestion? Thanks!