Hi,
in my app I use 2 layout, one for horizontal alignment and one for vertical alignment. Via a menu option the user can select the alignment.
My question: under which sub should the layout be loaded, directly under pMain_Resize, pnlRoot_Resize, or somewhere else?
Is there any recommendation or it doesn't matter?
Currently it is loaded directly after Application_Start, but it doesn't seem to work quite right.
in my app I use 2 layout, one for horizontal alignment and one for vertical alignment. Via a menu option the user can select the alignment.
My question: under which sub should the layout be loaded, directly under pMain_Resize, pnlRoot_Resize, or somewhere else?
Is there any recommendation or it doesn't matter?
Currently it is loaded directly after Application_Start, but it doesn't seem to work quite right.
B4X:
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
pMain.Initialize("pMain")
pMain.RootPanel.LoadLayout("Main")
LoadApplayout 'Here is currently loaded
...
End Sub
Private Sub pMain_Resize(Width As Int, Height As Int)
Dim r As Rect = pMain.SafeAreaInsets
pnlRoot.SetLayoutAnimated(0, 1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
'LoadApplayout 'Should it be loaded here?
End Sub
Private Sub pnlRoot_Resize(Width As Int, Height As Int)
'LoadApplayout 'Should it be loaded here?
...
End Sub
Sub LoadApplayout
If UserOrientation = Vertikal Then
pnlRoot.LoadLayout("layVertikal")
Else
pnlRoot.LoadLayout("layOrizontal")
End If
End Sub