0

I am trying to animate RecyclerView items using ConstraintSet animation. I have two layouts and they are switched properly using this code:

val constraint2 = ConstraintSet()
constraint2.clone(binding.root.context, R.layout.list_item_2)

val transition = ChangeBounds()
transition.interpolator = OvershootInterpolator(1.0f)
transition.duration = 1200
TransitionManager.beginDelayedTransition(binding.root.container, transition)

constraint2.applyTo(binding.root.container)

However delayed transition is completely ignored and it works the same way whether or not I add beginDelayedTransition code, so there is no animation.

Pochmurnik
  • 780
  • 6
  • 18
  • 35
Ana Koridze
  • 1,532
  • 2
  • 18
  • 28
  • 1
    when are you invoking the animation – Pawel May 09 '19 at 10:23
  • in onBindViewHolder – Ana Koridze May 09 '19 at 11:54
  • It will never work in `onBindViewHolder` because at that point `ViewHolder` is not part of the layout yet so it's not possible to perform transition. You could try to do it `onAttachedToWindow` but I'm not sure if that won't cause other issues. – Pawel May 09 '19 at 12:22

0 Answers0