Android Question Vertical or Horizontal center Designer Script

brelto85

Active Member
Licensed User
Longtime User
In the Designer Script, how can set the horizontal or vertical centering according to the container and not the entire layout?

For example, if i set the VerticalCenter = 50%Y of a panel that is contained in another panel, its position is centered vertical according the layout
 

NJDude

Expert
Licensed User
Longtime User
Assuming you have 2 panels Panel1 and Panel2 (Panel2 is contained in Panel1), you can do this in the designer scripts:
B4X:
Panel1.Width = 60%x
Panel1.Height = 60%y

Panel1.HorizontalCenter = 50%x
Panel1.VerticalCenter = 50%y

Panel2.Width = Panel1.Width / 2
Panel2.Height = Panel1.Height / 2

Panel2.Left = Panel1.Width / 4
Panel2.Top = Panel1.Height / 4
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…