android - Recyclerview only load Image when itemview is shown -


i load images in itemviews of recyclerview if itemview shown. tried in adapter far:

if (holder.itemview.isshown()) {             log.e("shown", "yes " + position);         }         if (holder.itemview.isfocused()) {             log.e("focused", "yes " + position);         }         if (holder.itemview.hasfocus()) {             log.e("hasfocus", "yes " + position);         } 

and tried in fragment add onscrolllistener recylcerview:

recyclerviewsearchgif.addonscrolllistener(new recyclerview.onscrolllistener() {             @override             public void onscrolled(recyclerview recyclerview, int dx, int dy) {                 super.onscrolled(recyclerview, dx, dy);              }              @override             public void onscrollstatechanged(recyclerview recyclerview, int newstate) {                 super.onscrollstatechanged(recyclerview, newstate);             }         }); 

but don't know how use case. sum up, detect current visible item in recyclerview while user scrolled in it.

when load images, mean load images network?

you should load/bind appropriate images in recyclerview.adapter#onbindviewholder in recyclerview's adapter, that's callback when item shown on screen.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -