android scroll - Check if items are completely visible in the RecyclerView -
i'm trying check if specific items visible in recyclerview
; couldn't implement that. please me determine if items visible in recyclerview
.
mrecylerview.addonscrolllistener(new recyclerview.onscrolllistener() { @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { super.onscrolled(recyclerview, dx, dy); linearlayout ll = (linearlayout) recyclerview.findchildviewunder(dx, dy); if (ll != null) { texturevideoview tvv = (texturevideoview) ll.findviewbyid(r.id.croptextureview); } } });
i want check if tvv
view visible within mrecyclerview
view.
you make logic using layoutmanager api last visible item position in recyclerview onscrolled method:
((linearlayoutmanager) vyourrecycler.getlayoutmanager()).findlastcompletelyvisibleitemposition();
from documentation: returns adapter position of last visible view. position not include adapter changes dispatched after last layout pass.
try use , notify recyclerview adapter refresh.
note: don't know why you're using findviewbyid in onscrolled method, work should implemented in recyclerview viewholder performance
Comments
Post a Comment