kotlin中实现匿名内部类

1.常规的方式实现匿名内部类

valueAnimator.addUpdateListener(object :AnimatorUpdateListener {
    override fun onAnimationUpdate(animation: ValueAnimator?) {
        currentPoint = animation?.animatedValue as Point
        postInvalidate()
    }

})
2.lambda 表达式版本的匿名内部类

valueAnimator.addUpdateListener { animation ->
    currentPoint = animation?.animatedValue as Point
    postInvalidate()
}

你可能感兴趣的:(kotlin中实现匿名内部类)