In onLayout you need to call layout method on each child of this ViewGroup and provide desired position (relatively to parent) for them. You can check source code of FrameLayout (one of the simpliest subclasses of ViewGroup) to find out how it works.
Although, if you don’t need any “special” layouting, you have other options:
- Extend some another subclass of
ViewGroupinstead (FrameLayoutfor example) - Use
LayoutInflaterif you just need your control to look exactly as in XML (which, I think, is exactly your case)