Osman
Osman

Reputation: 1011

Align CN1 Component depending on viewable area

I would like to align a component initially relative to the visible part of the containing parent (Container). The containing parent is planned to be a scrollable Tabs page but only that component should be visible initially on the page when selecting the tab.

In my example I want to position a Container (variable: root) at the bottom of the visible area of its parent. My current approach is to get the height of root and the height of root.getParent() and then set its top-margin as: root.getUnselectedStyle().setMarginTop(parentsHeight - rootsHeight);, but the result is not as expected. How can I manage this?

check the illustrations below:

intention

result

Note: when I add the root component programmatically then my approach works!

Upvotes: 1

Views: 34

Answers (1)

Osman
Osman

Reputation: 1011

finally I could detect the cause of the problem. The descirbed approach is correct, but I also had to pay attention for a specific point! Beneath the taps bar I have an additional component by default which gets hidden when initializing the containig form. Thus parentsHeight is lower than expected because I missed to revalidate the containing layout.

Upvotes: 1

Related Questions