Mx: wrapping text inside mx: List

I have an mx: Text tag with some text that I would like to display in a list. The code is below.

<mx:List id="projectList"
        width="100%"
        height="100%"
                         dataProvider="{project.projectRequirements}"
                         borderThickness="0">
                    <mx:itemRenderer>
                        <mx:Component>
                            <mx:HBox height="100%"
                                     minHeight="20"
                                     paddingBottom="0"
                                     paddingLeft="0"
                                     paddingRight="0"
                                     paddingTop="0"
                                     width="100%"
                                     horizontalScrollPolicy="off"
                                     verticalScrollPolicy="off">
                                <mx:Text width="100%"
                                         fontSize="12"
                                         text="{data.requirement.requirementText}"/>
                            </mx:HBox>
                        </mx:Component>
                    </mx:itemRenderer>
                </mx:List>

      

If I manually set the mx: HBox height, then something I know will allow multiple lines, then the text will be wrapped. I was really hoping that each component in the list could be of a different height, determined by the amount of text. Some text is 1 line, some are 4 or 5.

0


a source to share


1 answer


List has a variableRowHeight property which is set to false by default. Set to true and then make sure your renderer does NOT have the specified height (which is why it is measured instead).



You don't need to wrap your component in HBox, it can expand text directly.

+1


a source







All Articles