Why my canvas elements are not aligned properly in android game?

After i created a canvas in the game, i aligned the ui text button in the visible space. But when i run it in my phone, Some of them are out of the screen. They are not properly aligned.

Do i need to write a script for this?
Or is there any trick to do it?

Is the aspect ratio in the scene view set up for your phones ratio? That may be the problem

Use the canvas scaler that is attached to your canvas object:

52086-capture.png

It is defaulted to constant pixel size so change it to scale with screen size and play around with the values

Here’s the documentation for it: