I find that the Canvas coordinate system unit is different from the screen unit.
For example, in my case, as shown below:
For one specific point, its screen coordinate obtained from ImageView.getX() and ImageView.getY() is (336, 578) .
Then, by trial and error, I draw a point on the canvas, so that this point falls EXACTLY to the same position as ImageView. I called canvas.drawCircle(330, 440, radius, paint); to achieve this.
The question arises:
Why are the two coordinates (336, 578) and (330, 440) different?
Is it because different units are used on the screen and on canvas?
Is this a problem with pixel, dp and all that?
source share