Android Question Change View Parent in Designer Script

Discussion in 'Android Questions' started by Eldad Onojetah, Feb 11, 2019.

  1. Eldad Onojetah

    Eldad Onojetah Member Licensed User

    Hi,

    How can I change the parent of a view in the designer script?

    I am building a screen where the horizontal buttons on a panel at the top of the screen in portrait view, will be MOVED (by changing their parent) vertically to a new/another panel at the side of the screen in landscape view.

    I know I can do it in code, but I would love it done in the designer.

    Thanks.

    NB: Have searched but couldn't find an answer.
     
  2. DonManfred

    DonManfred Expert Licensed User

    you can not change it with a designerscript.
     
  3. Eldad Onojetah

    Eldad Onojetah Member Licensed User

    Ok. Thanks
     
  4. klaus

    klaus Expert Licensed User

    I would suggest you to define two layout variants.
    One for portrait and a second one for landscape.
    The views are the same but at different positions, the OS will load the correct one depending on the screen orientaion, therefore no need to move any view to another panel.
     
  5. Eldad Onojetah

    Eldad Onojetah Member Licensed User

    I actually have 2 variants, but it didnt work out.

    1. For portrait mode, I have a panel (pnlTop) at the top of the activity. this panel hosts 2 buttons: btnOk & btnCancel. pnlRight is hidden at this point.
    2. For landscape mode, I want a new panel (pnlRight) at the right hand of the activity. This activity should not host the 2 buttons above (btnOk & btnCancel). pnlTop is hidden at this point.

    What I have observed is that I cant change a views parent in the variant. It will change for ALL variants.

    Thanks.
     
  6. klaus

    klaus Expert Licensed User

    Do you intent to move the 2 buttons from pnlTop to pnlRight.
    No need.
    In the landscape layout, move pnlTop to the righ, the same size as pnlRight and position the buttons as needed.
     
  7. Eldad Onojetah

    Eldad Onojetah Member Licensed User

    My bad for not stating the problem completely!

    I also have other buttons on other panels that I have to move to pnlRight.

    I am currently moving the buttons in code.

    Thanks alot for your assistance.
     
  8. klaus

    klaus Expert Licensed User

    It still sounds strange to me.
    Could you post a small testproject showing the problem?
     
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