Create a size dependency between views

40 views Asked by At

Scenario: I have a activity layout with a viewpager containing multiple fragments and a header view with a dynamic height. The fragments should containe a placeholder with the same height of the header and its content.

enter image description here

Problem: How can i set the placeholder height inside the fragments view to the header height inside the activity view?

I want to create a custom view for the placeholder which find the header view from the activity and set its height to the height of the header.

I want a solution for the view-layer but it know that i can use the OnGlobalLayoutListener or OnPredrawListener on activity/fragment-layer.

In a nutshell: How can i access views from a custom view of the hole activity?

0

There are 0 answers