Marking Up Forms | Home | Bullit

Filed under Quick Tips on October 1, 2008 by Javier Julio

Removing Padding Between a Flex List and Its Item Renderers

While working on an AIR client, I had a design comp that required a line divider below each item renderer in a Flex List component. The List component has a style for alternating item colors but not for adding a line divider between each item renderer. I figured it shouldn't be that hard because I can simply add a bottom border on the container used for the item renderer.

I'm using a Canvas so the top portion of my MXML item renderer looked like:

Easy, but not quite there. You see the Flex List component seems to add some default spacing around the left and bottom parts of each item renderer from the List edge. You can see this in the following screenshot (I've changed the colors so the edges stand out):

javisimage1.png

As you can see, there is whitespace between the left edge and the starting point of the border and our selection highlight seems to be out of place. This is undesirable but there is an easy fix. It seems the List component has some default left and bottom padding set, so simply override it with nothing. Here I'm setting the rules globally to all List components, but you can replace it with the style name for a specific one if needed:

After applying that snippet of CSS, we now have an item renderer where the selection highlight is in line with the left edge of the List and the next item. You can see the result below:

javisimage2.png

Post a Comment Digg Del.icio.us

Trackback Pings (TrackBack URL for this entry)

http://www.arc90.com/cgi-bin/mt4/mt-tb.cgi/196.

Comments

Simple, yet effective!

Posted on October 8, 2008 1:58 PM by Carrie

Post a Comment:

Marking Up Forms | Main | Bullit