Flex 4: Setting Spark List height to its content height

前端 未结 5 1938
囚心锁ツ
囚心锁ツ 2020-12-16 15:50

How to set a Spark List height to the height of its content?

Tried this:

var lastRow:IVisualElement =
                 myList.dataGr         


        
相关标签:
5条回答
  • 2020-12-16 16:14

    In mxml you can do it like so:

    <s:List width="100%">
        <s:layout>
            <s:VerticalLayout useVirtualLayout="false" requestedMinRowCount="1"/>
        </s:layout>
    </s:List>
    

    You set the requestedMinRowCount or the requestedRowCount in the layout inside the List. It got me before, too. Hope that helps.

    0 讨论(0)
  • 2020-12-16 16:15

    For TileList I did it like this:

    <s:List width="100%" height="{(tilelayout.rowCount * tilelayout.rowHeight) + ((tilelayout.rowCount - 1) * tilelayout.verticalGap)}">
        <s:layout>
            <s:TileLayout id="tilelayout" rowHeight="190" columnWidth="130" horizontalGap="5" verticalGap="10" />
        </s:layout>
    </s:List>
    
    0 讨论(0)
  • 2020-12-16 16:22

    try this layout - for regular list

    <s:layout>
    <s:VerticalLayout horizontalAlign="contentJustify" 
      gap="0"
      verticalAlign="middle" 
      variableRowHeight="false"/>
    </s:layout>
    
    0 讨论(0)
  • 2020-12-16 16:24
    public class MyTileLayout extends TileLayout
    {
    
        override public function updateDisplayList(w:Number, h:Number):void
        {
            super.updateDisplayList(w,h);
    
            target.height = rowCount*rowHeight + verticalGap*(rowCount - 1);
        }
    
    }
    

    Or you can extend your TileLayout :)

    0 讨论(0)
  • 2020-12-16 16:24

    Easiest way to do this

    height="{list.dataGroup.contentHeight}"
    
    0 讨论(0)
提交回复
热议问题