How can I make my GridLayout dynamic (Adapting to different size views when I do layout.addView(newView, lp)) when I click a button, that button adds a view. But the view's size is chosen by the user. I just need to know how to dynamically add views of different sizes without having to set the layoutparams for each one.
My GridLayout is currently set out like this:
╔===============╗ ╔=======╗
║ ║ ║ ║
║ ║ ║ 2 ║
║ ║ ║ ║
║ ║ ╚=======╝
║ ║ ╔=======╗
║ 1 ║ ║ ║
║ ║ ║ ║
║ ║ ║ 3 ║
║ ║ ║ ║
║ ║ ║ ║
║ ║ ║ ║
╚===============╝ ╚=======╝
╔=========================╗
║ ║
║ 4 ║
║ ║
╚=========================╝
And add more views like this in order (1,2,3,4).
Any help is appreciated.
Thanks
0 comments:
Post a Comment