简体   繁体   中英

Change linear layout to constraint layout by hitting a button

So the screen is going to have some textViews and a button, by hitting the button, the layout should change from linear to constraint, vice versa. these two should have exact same paddings and alignments. I have my linear layout set up, how do I make an extra screen to perform constraint layout?

do I simply hide and unhide components? or is there a way to overlap the components? maybe create another layout.xml something like that?

You can make an copy of your linear layout.

Then open the copied new layout in design view, right click the root LinearLayout object in the hierarchy view, select "Convert LinearLayout to ConstraintLayout" from the popup menu.

I don't think it can create 100% same layout, but good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM