In the fragment view, I would like to adjust the layout settings of one of the child views based on the width of the containing view whose layout settings are set to match_parent. I need to do this to call getWidth / getHeight for the parent, and then set the child view to ViewGroup.LayoutParameters, etc.
The problem is that getWidth will only return a valid value after the layout was first created, and I'm not sure if there are any fragment overrides that I can use for this. For example, the actual width of a view is not determined when calling onCreateView or onStart.
So, is there an easy way to implement this, or will I have to subclass the view and override onLayout or onMeasure?
source share