Android : android Recyclerview Layoutmanager's onLayoutChildren called when item content is changed

on Saturday, April 18, 2015


i have a recycler view with custom layout manager ( its a twowayview staggeredgridview layout manager https://github.com/lucasr/twoway-view/blob/master/layouts/src/main/java/org/lucasr/twowayview/widget/StaggeredGridLayoutManager.java )


i am using this to display list of Images. These images are loaded asynchronously, meaning ,when the items becomes active, i decode image data and then load that bitmap onto these list item views.


now, problem is whenever i set image bitmap onto an item's imageview, it causes onLayoutChildren to be called on the layout manager, which then lays out all the children again.


Is this an expected behavior ? meaning, changing the content of child element ( here, imageview ) causes the parent recyclerview to issues a onLayoutChildren on its layoutmanager ?


if not, then how do i prevent this ?


Thanks,


0 comments:

Post a Comment