I am writing a drag and drop application and got really confused because of some parameters.
Please help to figure out.
First of all, I read the documentation fo
This is a supplemental answer for future visitors.
left
is the distance from the left side of the parent to the left side of the subview. Likewise, top
is the distance from the top of the parent to the top of the subview. Thus, getLeft()
and getTop()
return the coordinates of the top left corner of the view relative to its parent view (not the absolute coordinates on the screen).X, Y: Usually getX()
and getY()
will return the same thing as getLeft()
and getTop()
. However, sometimes it is useful to move the view a little after it has already been laid out. This can be done with setTranslationX()
and setTranslationY()
. If these have been set then x
and y
will be different from left
and top
, where
x = left + translationX
y = top + translationY
Width, Height: You can find the width and the height of the view with getWidth()
and getHeight()
. This is not affected by a translation.
The above values are all in pixel dimensions.