How can I change coordinates to bottom left corner?
I know that's in Java the coordinates begin from Top=Left corner, but I'm asking if can someone help me how can I change it to begin (0,0) coordinates from Bottom-Left corner?
How can I change coordinates to bottom left corner?
I know that's in Java the coordinates begin from Top=Left corner, but I'm asking if can someone help me how can I change it to begin (0,0) coordinates from Bottom-Left corner?
I think it's too late, but for people like me (new to android development). The above answers are correct but here is a more detailed one
If you get the coordinate with respect to top left as (a,b),
then the coordinates with respect to the bottom left are simply
(a, h-b)
where h is the height of the view.
Example:
float x = getXcoordinatesonTouch();
float y = getYcoordinatesonTouch();
//should return height
float h = getHeightoftheView();
float transformY = h - y;
//"x" should be as it is
//Now you can show "x" and "transformY"
getHeight()
will get you the size height. so(0, getHeight())
will give you the left-bottom point. But take into consideration the height of the object you want to place. So you may want to use