android - RecyclerView predictive item animations not working (APPEARING) -
i have recyclerview gridlayoutmanager (support lib v7). update adapter , make notifyitemmoved. if item source position on screen , destination position on screen - "move animation" played. in case if item @ position out of screen(position 1000, or other far viewport) , moved viewport appear "fade in animation".
looks predictive item animations not working despite on fact supportspredictiveitemanimations() returns true. doing wrong? should override methods enable it?
i reading source code of recyclerview, , in javadoc of dispatchlayout method written like:
- persistent views moved ({@link itemanimator#animatemove(viewholder, int, int, int, int)})
- removed views removed ({@link itemanimator#animateremove(viewholder)})
- added views added ({@link itemanimator#animateadd(viewholder)})
- disappearing views moved off screen
- appearing views moved on screen
nevertheless itemanimator doesn't distinguish added , appearing. possible fix predictife animations or @ least make appearing animation "move outside of screen animation" lefting added animation is?
you can try override getextralayoutspace(recyclerview.state state)
of linearlayoutmanager
provide manager space predictive animations.
example :
@override protected int getextralayoutspace(recyclerview.state state) { return getheight(); // add page better predictive animations }
the space added either @ start or @ end depending on previous scroll delta of scroll view. can take @ implementation of onlayoutchildren
of linearlayoutmanager
more details.
Comments
Post a Comment