I think it's better to put the view hierarchy into xml. This may require changes in TiCompositeLayout constructor to set the id properly. Though I'm not sure if we can load external xml from a module.