Flex stretched menubar items
I am using a Me开发者_如何学PythonnuBar in Flex:
<mx:MenuBar labelField="@label"
width="100%"
cornerRadius="0">
...
</mx:MenuBar>
By specifying the width as 100% the menu bar stretches across the entire container as desired, but I would also like the items inside to stretch to their maximum possible width instead of simply aligning to the left side.
Is this possible?
You may want to look into creating a custom ItemRenderer for your menu. I haven't played with a MenuBar at all, but in a quick lookover I see that it has a menuBarItemRenderer property. You may need to create your own renderer to have it do what you're looking for. Don't forget to implement the correct interfaces and override the data setting functions if you choose to go this route (should be easy to find tutorials online)
When you add items to the menu bar, you can also set their width to 100%. This gives the desired effect for me; alternatively, place the items in a HGroup with 100% width to override the menubar formatting.
精彩评论