Question

I am trying to center itemRenderers in a horizontal list if the number of items in the list is less than the maximum visible number. Has anyone found a good way to do this?

See an illustration of what I mean if it is hard to picture.

Thanks!

Was it helpful?

Solution

Override the measure() method - I've writen a blog entry here: http://flexmonkey.blogspot.com/2010/05/centre-aligned-horizontallist-in-flex.html

simon

OTHER TIPS

One solution that comes to mind would be to add invisible renderers to achieve the same centering.

You might want to consider using a horizontal box or "Hbox" instead of a horizontal list component. This will allow you to use the horizontal align property to set center. If not, simply extend the horizontal list component to accept a center align property, and copy it from the hbox to your new extended component.

Would paddingRight or paddingLeft accomplish what you're looking for? If you combine it with setting the columnWidth and the columnCount, that would allow you to adjust where the items first appear.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top