Reputation: 61
I have a custom view and i have added translate animation on initiate (onLoad). Its working fine when that view is used normally. But when the view is used inside recycler-view Row layout that animation is not happening properly. Some of the bottom Row having that custom view not showing translate animation. Below code is written in init block. And Recyler-view in implemented as usual.
init{
Handler().postDelayed({
val anim = AnimationUtils.loadAnimation(context,
R.anim.translate_alert_to_left)
startAnimation(anim)
}, 50)
}
Upvotes: 1
Views: 357
Reputation: 631
I'd need to see more of your code but I assume the init
block is the one in your custom view.
It shouldn't really be there, try putting it in onBindViewHolder
might do the trick, but if you should only start an animation when you need it rather than in when the View is created
Upvotes: 1