将扩展滚动条添加到 Flex 中的扩展火花列表
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 class 将所有功能都包装在它的皮肤中,所以我相信为了为 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>
我正在尝试将自定义 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 class 将所有功能都包装在它的皮肤中,所以我相信为了为 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>