I need an advice...I want to create custom view group that will have different layout depending on size of this view.
An example:
Two views:
- View A: child view that is at least 50dp height
- View B: my custom view that extends vertically oriented LinearLayout and is 200 dp height
What I want:
- When I insert 2 Views A into View B:
- I want to stretch these two Views A to 100 dp. So B will be common linear layout with 2 children.
- When I insert 5 Views A into View B:
- I want to add scroll view into B. All 5 Views A will be inside this scroll view and they will be 50 dp height.
Usually, I add views to my custom view in constructor. But I can't do it here because I don't know height of B in constructor. I know only height of A. So please advice me which callback method should I use...when height of B will be known so I can add all child views according this height.
Or if you know any other approach...please let me know...
Thank you very much!