我正在研究kotlin项目,我尝试将java中的方法转换为kotlin.我现在收到此错误
使用提供的参数不能调用以下任何函数.
它发生在 ObjectAnimator.ofFloat()
守则如下
码
fun animate(holder: RecyclerView.ViewHolder, goesDown: Boolean) {
val animat = AnimatorSet()
val objectY = ObjectAnimator.ofFloat(holder.itemView, "translationY", if (goesDown) 200 else -200, 0)
objectY.setDuration(Kons.Duration.toLong())
val objectX = ObjectAnimator.ofFloat(holder.itemView, "translationX", -50, 50, -30, 30, -20, 20, -5, 5, 0)
objectX.setDuration(Kons.Duration.toLong())
animat.playTogether(objectX, objectY)
animat.start()
}
Run Code Online (Sandbox Code Playgroud)