Please note that the origin (0,0)
in Android screen is situated at top-left corner of the screen. Thus, when you add values to y axis
the object go towards bottom and when subtract values the object goes upwards.
In Android devices:
Origin
|
V
*-------------------------------
| ----> X axis |
| | |
| | |
| V Y-axis |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
-------------------------------
Possible History:
As screen space calculations started when television sets were used as screens. The raster gun of a TV is also starting at the top left corner, so this was accepted as the origin.
For further reference you can refer here
Transformations:
However, you can use the transformation of coordinates in android using Canvas.setMatrix()
.
You can flip your Canvas
with using
canvas.translate(0,canvas.getHeight());
canvas.scale(1, -1)
to shift it to the correct location.
You can refer here for transformation.