iOS Question AddView from LoadLayout

Paul Leischow

Member
Licensed User
Longtime User
In B4A I can design a layout in the layout designer and add it as a view. Then use the Visible command to display it. I can also create a second layout with a transparent background and display that view over top the current visible layout.

How do I accomplish the same thing in B4I ? The LoadLayout only seems to work with RootPanel (unless I missed something) and when you bring a layout in to view any previous layout is removed. I can't seem to place a transparent background layout over an existing layout.

B4A Psudo Code...
B4X:
    Activity.LoadLayout("Main")

    screen1.Initialize("")
    Activity.AddView(screen1,0,0,100%x,100%y)
    screen1.LoadLayout("screen1")

    screen2.Initialize("")
    Activity.AddView(screen2,0,0,100%x,100%y)
    screen2.LoadLayout("screen2")
   
    screen1.Visible=True
 

Semen Matusovskiy

Well-Known Member
Licensed User
https://www.b4x.com/b4i/help/views.html

Method_636.png
LoadLayout (LayoutFile As String) As LayoutValues

Loads a layout file to the panel.

Any panel, not Page.RootPanel only. In general an algorithm is similar as in B4A.
 
Upvote 0

Paul Leischow

Member
Licensed User
Longtime User
Ok, I finally figured it out.
I wasn't seeing the screen2.LoadLayout option because I had screen2 defined as a Page instead of Panel... which is why I was seeing screen2.RootPage.LoadLayout as the only option.

Thanks for the feedback.
 
Last edited:
Upvote 0
Top