user100943
user100943

Reputation:

Centering item renderers in a HorizontalList

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!

Upvotes: 1

Views: 1240

Answers (4)

Flex Monkey
Flex Monkey

Reputation: 3633

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

simon

Upvotes: 0

cwallenpoole
cwallenpoole

Reputation: 82028

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.

Upvotes: 0

Mike
Mike

Reputation: 1

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.

Upvotes: 0

Brandon
Brandon

Reputation: 6872

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

Upvotes: 0

Related Questions