java - RecyclerView.Adapter hook method issue -
as title suggests have issue recyclerview adapter callback hooks. have 6 items in recyclerview, these views custom views have own logic, animations etc.. these views fine, , work expected. have issue when show framelayout on recyclerview layout. framelayout nothing special, , change visiblity gone visible.
when happens recyclerview calls these methods:
@override public void onviewdetachedfromwindow(recyclerview.viewholder holder) @override public void onviewdetachedfromwindow(recyclerview.viewholder holder) @override public void onviewrecycled(recyclerview.viewholder holder) these called positions (0 - 5). @ point stop animations in custom views, , reset them ready state. far seems reasonable, views obscured, these hooks called.
the issue
when set overlay framelayout visible gone again recyclerview calls onbindviewholder first 4 positions (0-3), not called positions 4 & 5 (confirmed break points , logging). means views in these positions don't initialise - done in onbindviewholder.
so i'm asking why onbindviewholder isn't called positions recycled, when 6 views in recyclerview visible on screen @ same time?
i post code, in instance i'm talking logic , hooks of recyclerview.adapter class, implementation merely using these hooks.
edit
i have working solution, rather setting custom view in onbindviewholder use :
to reset view:
@override public void onviewdetachedfromwindow(recyclerview.viewholder holder) to initialise view:
@override public void onviewattachedtowindow(recyclerview.viewholder holder) these 2 hook methods seem logical opposites of each other, , work such, still mystery why onbindviewholder isn't called views.
Comments
Post a Comment