Lets say that we want to build a layout such as the above where the screen is split into two halves.
If we try to build this layout with a single layout file we will quickly meet a problem.
We will add this designer script to split the screen:
pnlTop.SetTopAndBottom(0, 50%y) pnlBottom.SetTopAndBottom(50%y, 100%y)
This means that we will not be able to use anchors and will need to set the size of all the views in the designer script.
However there is a better solution, we can split the layout into three nice and clean layout files and load them with:
Sub Globals Private WebView1 As WebView Private pnlTop As B4XView Private pnlBottom As B4XView End Sub Sub Activity_Create(FirstTime As Boolean) Activity.LoadLayout("Main") pnlTop.LoadLayout("Top") pnlBottom.LoadLayout("Bottom") End Sub
Note that the variant size doesn't matter. The nested layouts will be resized based on the parent panels sizes.
12.8 KB Views: 133