Android Question Change View Parent in Designer Script

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.
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

klaus

Expert
Licensed User
Longtime 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.
 
Upvote 0

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.
 
Upvote 0

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.
 
Upvote 0
Top