簡體   English   中英

將擴展的Scroller添加到Flex中的擴展的Spark List

[英]Add extended Scroller to extended spark List in Flex

我正在嘗試將自定義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>

List行為運行良好,但擴展的Scroller組件根本無法運行。
將此滾動條功能(在MXML或ActionScript中)添加到列表的正確方法是什么?

s:Scroller通過將其包裝在內容或數據組周圍來使用。 但是List類將所有這些功能包裝在皮膚內部,因此我相信,要為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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM