RecyclerView item animation


if (imageView.isSelected) {
    ValueAnimator.ofInt(size, (size * 1.8).toInt()).apply {        
        addUpdateListener { values ->            
            imageView.layoutParams.width = values.animatedValue as Int
            imageView.layoutParams.height = values.animatedValue as Int
            imageView.requestLayout()
        }        duration = 200        start()
    }    val anim = ScaleAnimation(0.5f, 1f, 0.5f, 1f,
        Animation.RELATIVE_TO_SELF, 0.5f,
        Animation.RELATIVE_TO_SELF, 0.5f    )
    anim.fillAfter = true    imageView.startAnimation(anim)
} else {
    imageView.layoutParams.width = size
    imageView.layoutParams.height = size
}

Comments

Popular posts from this blog

Working with Android Hierarchy Viewer

change svg android drawable color