Apache flex Flex:将多个列表放在一个滚动条中
我想把多个列表放在一个滚动条中(每个列表都不可滚动)。我在下面所做的工作是有效的,但在每个列表之后都有一个巨大的随机间隙。我已经检查了渲染器。挂起,没有任何原因造成的差距。我注意到只有当我将verticalScrollPolicy设置为off时才会发生这种情况。我不想将其设置为on,否则列表本身将可滚动Apache flex Flex:将多个列表放在一个滚动条中,apache-flex,actionscript,flash-builder,flex-spark,Apache Flex,Actionscript,Flash Builder,Flex Spark,我想把多个列表放在一个滚动条中(每个列表都不可滚动)。我在下面所做的工作是有效的,但在每个列表之后都有一个巨大的随机间隙。我已经检查了渲染器。挂起,没有任何原因造成的差距。我注意到只有当我将verticalScrollPolicy设置为off时才会发生这种情况。我不想将其设置为on,否则列表本身将可滚动 <s:Scroller height="80%" width="100%"> <s:VGroup width="100%">
<s:Scroller height="80%" width="100%">
<s:VGroup width="100%">
<s:Label bottom="5" width="100%" styleName="normalWhite" text="Heading 1" textAlign="left" fontSize="18" />
<s:List id="pendingList1"
width="100%"
includeIn="pending"
dataProvider="{Info}" contentBackgroundAlpha="0"
itemRenderer="renderers.Pending"
styleName="customList" alternatingItemColors="[#13237d]"
selectionColor="#009de0"
dragEnabled="false"
dragMoveEnabled="false"
dropEnabled="false"
verticalScrollPolicy="off">
<s:layout>
<s:VerticalLayout horizontalAlign="justify" gap="1"/>
</s:layout>
</s:List>
<s:Label bottom="5" width="100%" styleName="normalWhite" text="Heading 2" textAlign="left" fontSize="18" />
<s:List id="pendingList2"
width="100%"
includeIn="pending"
dataProvider="{Info}" contentBackgroundAlpha="0"
itemRenderer="renderers.Pending"
styleName="customList" alternatingItemColors="[#13237d]"
selectionColor="#009de0"
dragEnabled="false"
dragMoveEnabled="false"
dropEnabled="false"
verticalScrollPolicy="off">
<s:layout>
<s:VerticalLayout horizontalAlign="justify" gap="1"/>
</s:layout>
</s:List>
</s:VGroup>
</s:Scroller>
好吧,我试着模拟你的问题,但我没有理解。正如你所说,我的代码运行良好 test.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application1_creationCompleteHandler(event)">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
private var Info:ArrayCollection = new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]);
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
// TODO Auto-generated method stub
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
Info.addAll(new ArrayCollection(["num 1","num 2","num 3","num 4","num 5","num 6","num 7","num 8","num 9","num 10"]));
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Scroller height="80%" width="100%">
<s:VGroup width="100%">
<s:Label bottom="5" width="100%" styleName="normalWhite" text="Heading 1" textAlign="left" fontSize="18" />
<s:List id="pendingList1"
width="100%"
dataProvider="{Info}" contentBackgroundAlpha="0"
itemRenderer="renderers.Pending"
styleName="customList" alternatingItemColors="[#13237d]"
selectionColor="#009de0"
dragEnabled="false"
dragMoveEnabled="false"
dropEnabled="false"
>
<s:layout>
<s:VerticalLayout horizontalAlign="justify" gap="1"/>
</s:layout>
</s:List>
<s:Label bottom="5" width="100%" styleName="normalWhite" text="Heading 2" textAlign="left" fontSize="18" />
<s:List id="pendingList2"
width="100%"
dataProvider="{Info}" contentBackgroundAlpha="0"
styleName="customList" alternatingItemColors="[#13237d]"
selectionColor="#009de0"
dragEnabled="false"
dragMoveEnabled="false"
dropEnabled="false"
>
<s:layout>
<s:VerticalLayout horizontalAlign="justify" gap="1"/>
</s:layout>
</s:List>
</s:VGroup>
</s:Scroller>
</s:Application>
渲染器。挂起
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
autoDrawBackground="true">
<s:Label text="{data}"/>
</s:ItemRenderer>
请不要寻找编码标准。这里太糟糕了。
我使用的Flash Builder 4&sdk版本是4.1设置variableRowHeight=“false”有效并消除了随机空白。但是,现在所有列表项的高度都是最高列表项的高度。我想这是暂时的解决办法 将VGroup上的间距设置为0尝试将所有
列表的高度设置为100%
。这只会切断每个列表中的项目。我没有将其设置为100%,以便在每个列表中显示所有项目而不滚动。然后,滚动器应该允许用户滚动所有列表及其项目;但是每个列表都使用相同的renderer函数和dataProvider。你想实现什么?两个列表都来自相同的数据,唯一的区别是每个列表处理不同的类别。我使用的是Flash Builder 4.7、Flex 4.6和AIR SDK 3.4。我在iOS模拟器中遇到此错误。我认为您正在使用IconItemRenderer
作为renderers.Pending
。请尝试使用itemrender
。它将解决您的问题。不,我正在使用ItemRenderer标记。我注意到它与renderers.Pending有关。我把所有的东西都放在一个组里。它与不同高度的列表项有关。