Android set view position - setY vs setTop

The main difference between setY() and setTop() is that setY() sets the top offset of the view relative to the visual area, whereas setTop() sets the top offset of the view relative to its parent.

From the Android documentation.

setY()

Sets the visual y position of this view, in pixels. This is equivalent to setting the translationY property to be the difference between the y value passed in and the current top property.

setTop()

Sets the top position of this view relative to its parent.