Answer the question
In order to leave comments, you need to log in
How to use RecyclerView to redraw visible elements on a timer?
The bottom line is this: There is a RecyclerView in each element of the list there is a ProgressBar and it is necessary to update the progress in it on a timer. ListView has an invalidateViews() method which solved the update issue. How to update visible items in RecyclerView? The adapter's notifyDataSetChanged() method is not suitable - just a redraw is needed, and notifyItemChanged(position) - causes items to flash on update.
Answer the question
In order to leave comments, you need to log in
Maybe try to store links to your ProgressBar and call invalidate on the timer? Moreover, you don’t need to redraw everything else ..
Or, as an option, go over all the children of the RecyclerView and call them invalidate
We must not forget ListView is such a monster thing that could do everything itself, and in RecyclerView a lot was left to you ..
If you look at the ListView source :
/**
* Causes all the views to be rebuilt and redrawn.
*/
public void invalidateViews() {
mDataChanged = true;
rememberSyncState();
requestLayout();
invalidate();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question