Open NSouth opened 8 years ago
Hi. Which version of the old libraries have you been using?
support-v7-recyclerview
I think this unwanted animation is related to item change animations. The RecyclerView
has been changed some times around the change animation. Here is a picked up important revision history of it;
Changes for v7 recyclerview library:
If you’ve previously extended the ItemAnimator class, you can change your base class to SimpleItemAnimator
and your code should work as before. The SimpleItemAnimator class provides the old API by wrapping the new API.
Some methods were removed from the ItemAnimator class. The following code will no longer compile:
recyclerView.getItemAnimator().setSupportsChangeAnimations(false)
You can replace it with:
ItemAnimator animator = recyclerView.getItemAnimator();
if (animator instanceof SimpleItemAnimator) {
((SimpleItemAnimator) animator).setSupportsChangeAnimations(false);
}
Changes for v7 RecyclerView library:
RecyclerView.ViewHolder
with payload information, DefaultItemAnimator
now disables change animations.source: http://developer.android.com/tools/support-library/index.html#revisions
Thanks
Thanks for the reply. I haven't been able to get it back to working as smoothly as it did before and, but I played with the following and, while the remove animation is no longer pretty, at least it's short and doesn't bother me as much anymore. I don't have the time to dig into this any deeper, although I'm sure there's a way to make this work as it once did.
animator.setMoveDuration(150);
animator.setChangeDuration(200);
animator.setRemoveDuration(40);
I was having the same problem but managed to fix it. I had android:layout_height="wrap_content"
on my RecyclerView
. With match_parent
the remove animation quirk no longer happens.
This depends on your use of course. For my layout, match_parent
worked.
I've been using a custom implementation of this library for a while (so just downloading the latest version would overwrite my customizations).
See the animated GIF below. When collapsing, the "Lab" group disappears and then shows up under "Exams" instead of smoothly moving up beneath it. This used to be a much smoother transition and I'm wondering if someone can help me figure out what's changed in recent Android updates and which classes from this library I need to update to correct this. I've already gone through and tried updating the animator classes, but to no avail. I'd appreciate any tips. Thanks.
Animation of behavior - GIF