Flex 4:将Spark List高度设置为其内容高度 [英] Flex 4: Setting Spark List height to its content height
本文介绍了Flex 4:将Spark List高度设置为其内容高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何将 Spark List 高度设置为其内容的高度?
How to set a Spark List height to the height of its content?
试过这个:
Tried this:
var lastRow:IVisualElement =
myList.dataGroup.getElementAt(myList.dataGroup.numElements - 1);
myList.height = lastRow.y + lastRow.height;
它适用于单个项目,但是 lastRow 为null例如,更多的项目。
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 List高度设置为其内容高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文