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

Discussion in 'Android Questions' started by agb2008, Apr 8, 2015.

  1. agb2008

    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:
    Code:
    Activity.LoadLayout("Main")
    Then I load my main application layout using:
    Code:
    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:
    Code:
    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 ?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You can add multiple layouts to the same panel. It should work properly. Make sure that the views names are different (if you want to reference the views in your code).
     
    agb2008 likes this.
  3. agb2008

    agb2008 Member Licensed User

    Erel,
    Thank you very much for quick reply and confirmation. :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice