B4J Question Adjust layout size at screen (SOLVED)

josete

Member
Licensed User
Longtime User
Hi,i'm making a desktop application that i want to run maximized and adjust to screen size.I found this code that allow this and works fine:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
   MainForm = Form1
   MainForm.WindowWidth = fx.PrimaryScreen.MaxX - fx.PrimaryScreen.MinX
   MainForm.WindowHeight = fx.PrimaryScreen.MaxY - fx.PrimaryScreen.MinY
   MainForm.WindowLeft = fx.PrimaryScreen.MinX
   MainForm.WindowTop = fx.PrimaryScreen.MinY
   MainForm.RootPane.LoadLayout("MainLayout")
   MainForm.Show
End Sub

but i want to do the same with the layout measures to adapt it at different screens resolutions.Can i change the layout with and height at runtime?.Thanks.
 
Top