Flex 4:将 Spark 列表高度设置为其内容高度 [英] Flex 4: Setting Spark List height to its content height

查看:24
本文介绍了Flex 4:将 Spark 列表高度设置为其内容高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将 Spark List 的高度设置为其内容的高度?

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

试过这个:

var lastRow:IVisualElement =
                 myList.dataGroup.getElementAt(myList.dataGroup.numElements - 1);
myList.height = lastRow.y + lastRow.height;

它适用于单个项目,但 lastRow 在多个项目的情况下为空.

It works in case of a single item, but lastRow is null in case of more items.

推荐答案

在 mxml 中你可以这样做:

In mxml you can do it like so:

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

您在列表内的布局中设置了requestedMinRowCount 或requestedRowCount.我之前也遇到过.希望有所帮助.

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

这篇关于Flex 4:将 Spark 列表高度设置为其内容高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆