RecyclerView: Animate item resize

后端 未结 2 1065
逝去的感伤
逝去的感伤 2021-02-02 12:38

I have a RecyclerView. Each of its items of the recycler view can be either expanded or not. There can be only one item expanded at the same time.

In essenc

2条回答
  •  臣服心动
    2021-02-02 13:05

    OK, So I have found a solution that does not involve calling notifyItemChanged so the view is not replaced. The con is that you have to manualy check the view consistency. For that, I have created a small library that allows exactly what I was looking for, for 5 loc in the ViewHolder.

    The trick is to animate height change manualy rather than using a LayoutTransition.

    The demo project can be found here.

提交回复
热议问题