【问题标题】:Flex mobile list with large overhead datasets具有大量开销数据集的 Flex 移动列表
【发布时间】:2014-02-07 03:31:06
【问题描述】:

我遇到了一个问题,即加载包含 100 个条目的列表需要很长时间。我正在使用预生成的数组集合传递给数据提供者,并且自定义项渲染器由嵌套容器组成。在我称之为 list.dataProvider = arraycollection; 的那一刻,它会冻结大约 4 秒钟,然后只出现列表。

是否有解决此问题的解决方法?

以下是我的代码:

[编辑]

    private function populateList():void
        {
            array = new Array();

            for (var i:int =0;i<100;i++)
            {
                array.push({
                    dateLabel:"LIVE",
                    timeLabel:"06:05",
                    homeTeamLabel:"Liverpool",
                    homeScoreLabel:"1",
                    awayScoreLabel:"0",
                    awayTeamLabel:"Chelsea",
                    homeTeamHandicapLabel:"Liverpool",
                    homeHandicapLabel:"2/5",
                    awayTeamHandicapLabel:"Chelsea",
                    awayHandicapLabel:"",
                    priceHomeHandicapLabel:"1.950",
                    priceAwayHandicapLabel:"1.950"
                });
            }

            trace("done loading");

            testarr = new ArrayCollection(array);

            liveList.dataProvider = testarr;
        }

这是我的列表组件:

    <s:Scroller width="100%" height="100%" horizontalScrollPolicy="off">
    <s:VGroup id="lists" gap="0" left="0" right="0" top="0" bottom="0">
        <s:List id="liveList" width="100%" itemRenderer="customItemRenderer" creationComplete="populateList()"
                contentBackgroundColor="0xf0f0f0" useVirtualLayout="true" depth="0" horizontalScrollPolicy="off" verticalScrollPolicy="off">
            <s:layout>
                <s:VerticalLayout gap="0" variableRowHeight="true" requestedMinRowCount="1" useVirtualLayout="true"/>
            </s:layout>

        </s:List>
    </s:VGroup>
</s:Scroller>

【问题讨论】:

  • 你应该显示更多代码。
  • 同时指定您的目标设备。这是设备上的问题吗?在模拟器中?是调试版本还是发布版本?
  • 您好,感谢您的评论,我的代码已添加。它是 Android 设备的发布版本。
  • itemrenderer 中有什么?粘贴代码。你的列表看起来不错。

标签: list apache-flex mobile itemrenderer arraycollection


【解决方案1】:

事实证明,当我使用 Scroller 和 VGroup 包装列表时,性能会受到影响。当我删除它们时,列表加载得很好。

【讨论】:

    猜你喜欢
    • 2013-05-04
    • 1970-01-01
    • 1970-01-01
    • 2019-08-15
    • 1970-01-01
    • 1970-01-01
    • 2012-07-06
    • 2020-10-29
    • 2014-02-15
    相关资源
    最近更新 更多