问题
How can I add a layout (a HorizontalLayout to be specific) to a Flex UIComponent?
I'm working on a large mobile application, hence I'd like to avoid using additional containers like HGroups and work with more lightweight components.
As usual, any help would be greatly appreciated!
回答1:
You can't and you don't really need to.
You can't, because only Spark components were designed with an encapsulated layout mechanism. mx components were not and you can't assign a layout to UIComponent.
You don't really need to, because Groups were already designed to be very lightweight containers without any graphical elements in them. Their only purpose is to layout other components.
Now if you really want to trim them down, you can always create your own copy of Group that contains only the properties you really need, but in my opinion that would be a huge time-waster for a barely (if at all) noticeable gain.
来源:https://stackoverflow.com/questions/11309683/add-layout-to-flex-uicomponent