Canvas for multiple phone screen


How to fix x and y coordinates on a canvas for multiple phone screen sizes.

For example
I want to place an object on x:200, y:100 on a screen size 500*700
But when I run same app on bigger screen size phone e.g 720, 900.
The object becomes displaced from its position.

Is there any way to set x,y coordinates of an objects according to screen size percentage so the object wont displaced from its original position regardless or screen size?


No, not if you are positioning an object by its x,y coordinate.

for your 500x700 screen, x = 200/500 or 2/5 of the screen edge offset; y =100/500 or 1/5 of the screen edge offset

Solve the following for a 720x900 screen:
X/700 = 2/5 solve for new X
Y/900 = 1/5 solve for new Y

that would mean that the corresponding x,y on the larger screen would be X= 140 ; Y= 180

Did I do that correctly? Try those calculated coordinates on your 720x900 screen

If the proportion works, you can set the object by using proportions. Only you know if this is what you need to do. What you do depends on how you code your Canvas Blocks and WxH.