Just Do like this
view.animate()
.translationY(-((root.height - (view.height)) / 2).toFloat())
.setInterpolator(AccelerateInterpolator()).duration = 1500
Here, view
is your View which is animating from its origin position. root
is root View of your XML file.
Calculation inside translationY
is made for moving your view to the top but keeping it inside the screen, otherwise, it will go partially outside of the screen if you keep its value 0.