hi,
You are nearly there.
All you need to do is have a master panel which is loaded into Root. This contains the 2 other panels, panel1 & panel2, each of which is the full size.
Then load the layouts into Panel1 and Panel2.
Then show/hide the 2 panels as required.
so
Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Dim Panel1, Panel2 As B4XView ' I add two panels
....
Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Page1") ' Page1 contains panel 1 & panel 2
'Panel1.Initialize("") : Panel2.Initialize("") ' No need for this line
Panel1.LoadLayout("Layout1") : Panel2.LoadLayout("Layout2")
flippanels(true) ' show panel1
' Activity.AddView(Panel2, 0, 0, 100%x, 100%y) 'No need for this line
....
private sub flippanels(show1 as boolean) ' for use later in the code
panel1.visible = show1
panel2.visible = not(show1)
end sub