Android Question Multiple layout files (.bal) in single activity

agb2008

Member
Licensed User
I've created three layout files (.bal) in Designer - each one contains panel with few items such as labels, spinners and edittext items... That was done, because I plan to reuse them in few of my projects.
But then I realize that there might be an issue with such approach...
I use layout "Main" with single ScrollView field: "scvMain". That layout loaded into activity using:
B4X:
Activity.LoadLayout("Main")
Then I load my main application layout using:
B4X:
scvMain.Panel.LoadLayout("main_calc_pnl")
But how I correctly load another layout file into the same Activity/Panel ?
It seems that if I add another statement, right after loading "main_calc_pln" such as:
B4X:
scvMain.Panel.LoadLayout("CompPar")
And then use panel visibility option - application works as expected - but is it correct way of layout files usage ? Or should I extend my "main_calc_pln" layout file, add two panels there once again with Visibility=False and then switch them on when needed ? It's just the case when I do not need separate activity. Please advice - what's the best way of handling such issue ?
 
Top