RecyclerView settle item with Decelerate Interpolator once scroll finishes

时间秒杀一切 提交于 2019-12-24 20:19:03

问题


I want to animate the RecyclerView scrolling. I don't want to animate adding or removal of items but rather animate items which are on screen, i.e visible items. What I want is, item settle down smoothly when scrolling is about to finish. I am not sure what approach should I take or how this can be done. I have tried following till now

  • Using RecyclerView.OnScrollListener, when I get onScrolled callback, I find visible items & animate them upside or downside based on scroll direction. But this approach is no-where near to perfect & many times when scrolling fast, some visible views are null so animation doesn't apply on them & it looks weird.
  • Tried to animate visible items when I receive SCROLL_STATE_IDLE. But there's noticeable delay for a fraction of second when scrolling is finished & then items animate. It doesn't look natural
  • Tried to figure out when RecyclerView scrolling is "about to" finish so I can start animation to mimic continuity of animation with scrolling. But didn't get success in identifying reliably that scrolling is about to finish.

Instead of above a little complex ways that doen't work the way I need, I wonder if there is any other way like creating custom LayoutManagerwhere I can override the each item scrolling so that it settle to it's aimed position smoothly?

Edit: Here's something very close to what I wanted

来源:https://stackoverflow.com/questions/45858059/recyclerview-settle-item-with-decelerate-interpolator-once-scroll-finishes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!