apache-flex 在Flex中将扩展的Scroller添加到扩展的spark列表

6yjfywim  于 2022-11-01  发布在  Apache
关注(0)|答案(1)|浏览(127)

我正在尝试将自定义Scroller.as(从spark.components.Scroller扩展)添加到InfiniteScrollList.as(从spark.components.list扩展)
我编写了以下MXML代码:

<list:InfiniteScrollList width="100%" height="100%" id="EventsList" useVirtualLayout="true">
    <list:scroller>
         <list:Scroller/> <!-- The Scroller.as Class -->
    </list:scroller>
</list:InfiniteScrollList>

“列表”行为运行良好,但扩展的Scroller组件根本不起作用。
将此滚动条功能(在MXML或ActionScript中)添加到列表中的正确方法是什么?

esbemjvw

esbemjvw1#

s:Scroller是通过将其 Package 在内容或DataGroup周围来使用的。但是List类将所有这些功能 Package 在它的皮肤内部,所以我相信为了为List创建自定义Scroller,实际上需要在SkinClass内完成。

<list:InfiniteScrollList  width="100%" height="100%"  id="EventsList"
      useVirtualLayout="true" skinClass="MyListSkin" />

MyListSkin.mxml:

<s:SparkSkin xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark"
  xmlns:fb="http://ns.adobe.com/flashbuilder/2009" minWidth="112"> 

<fx:Metadata>
    [HostComponent("spark.components.Scroller")]
</fx:Metadata> 

<s:states>
    <s:State name="normal" />
    <s:State name="disabled" />
</s:states>

    <!-- The Scroller.as Class -->
    <list:Scroller left="0" top="0" right="0" bottom="0" id="scroller" hasFocusableChildren="false">
        <!--- @copy spark.components.SkinnableDataContainer#dataGroup -->
        <s:DataGroup id="dataGroup" itemRenderer="spark.skins.spark.DefaultItemRenderer">
            <s:layout>
                <!--- The default layout is vertical and measures at least for 5 rows.  
                When switching to a different layout, HorizontalLayout for example,
                make sure to adjust the minWidth, minHeight sizes of the skin -->
                <s:VerticalLayout gap="0" horizontalAlign="contentJustify" requestedMinRowCount="5" />
            </s:layout>
        </s:DataGroup>
    </list:Scroller/>
</s:SparkSkin>

相关问题