Please, can you write me an example? For example, how can I set at the center of the screen 2 buttons?
For a fixed orientation like this, instead of setting the offset by
dip, you should use
50%x in the
Designer Scripts, rather than code.
MyButton.HorizontalCenter = 50%x
If you wanted to have the button width scale by width of the display, you would align the buttons like this:
LeftButton.Width = 20%x
LeftButton.Right = 48%x
RightButton.Width = 20%x
RightButton.Left = 52%x
You can change the width of the buttons by increasing the percentage. Note that this is a percentage of the total width of the display. The left button takes up exactly 20% of the display, horizontally. The Right button does as well.
If you didn't want them to scale (have the same physical width regardless of display), but always wanted them to be center-aligned:
LeftButton.Width = 80dip
LeftButton.Right = 48%x
RightButton.Width = 80dip
RightButton.Left = 52%x
You can change this button width by increasing the
dip size. Please note that this button will scale to a certain physical width no matter the display size, so you shouldn't set it too large, because it won't scale correctly on small displays that don't have a display wide enough. They'll scale, but will go off-screen.