Using Explicit Height Items with IconItemRenderer

I came across SDK-31840 when building a Facebook app that shows status updates in a list.

By default, IconItemRenderer sizes to fit it’s contents. If you have a very long message (like a Facebook status update), the item renderer measures to fit the height required to display the full message.¬†What this item renderer doesn’t handle quite right is when the a fixed (explicit) height is specified.

In the end, really needed 2 things. I wanted to cap the item renderer height and let the message truncate. I hit 2 problems (1) truncating and adding an ellipsis doesn’t work for multi-line text and (2) the message would overflow out of the item renderer when I specified an explicit height.

How did I fix it? I monkey patched my IconItemRenderer. I could have also just subclassed and replaced measure() and layoutContents(). I could have even just gone with an MXML version that I wrote that had pretty darn good performance using opaqueBackground and cacheAsBitmap set on the item renderer.

Anyhow, if you’re in the same boat or just curious, check out the patch attached to the bug.

Share on Facebook

Comments are closed.