I’m writing a composite view by overriding a ViewGroup, like so:
public class CompositeView extends RelativeLayout
I need to perform some one-time initialization after the measurements have been set (i.e. onMeasure has been called) because I need to know the height.
I was thinking of overriding onAttachedToWindow, but the docs mention that:
it may be called any time before the first onDraw — including before or after onMeasure(int, int).
What other options do I have?
Thanks
I prefer to use onSizeChanged in my CustomViews:
This method is called once after layouting is finished. This questions gives some extra details.