Flex 4 Scroller component doesn't render horizontal scrollbar
I'm pretty sure my dynamic mxml layout must give me two scrollbars (horizontal and vertic开发者_StackOverflow社区al) but it only shows vertical one. Am I missing something or is it a bug?
<?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" width="100%" height="100%" xmlns:local="*">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
[Bindable]
public var myData:ArrayCollection = new ArrayCollection([
{name:"Jane"},
{name:"Sonny"},
{name:"Alicia"}
]);
]]>
</fx:Script>
<s:Scroller width="100%" height="100%">
<s:VGroup>
<s:Group minHeight="600" minWidth="800" height="100%" width="100%">
<mx:HDividedBox id="div1" width="100%" height="100%" autoLayout="true" liveDragging="true">
<mx:DataGrid width="100%" height="100%" dataProvider="{myData}"/>
<mx:DataGrid width="100%" height="100%" dataProvider="{myData}"/>
</mx:HDividedBox>
</s:Group>
</s:VGroup>
</s:Scroller>
</s:Application>
Remove the VGroup inside the Scroller or change it to Group! Seems that the horizontal scrollbar is not shown when using VGroup as first child
You haven't set horizontalScrollPolicy
and verticalScrollPolicy
for the Scroller
and hence they have their value set to the auto
. The behavior in this case is to display the scrollbars only if necessary.
The scroll bars are displayed according to the vertical and horizontal scroll bar policy, which can be auto, on, or off. The auto policy means that the scroll bar will be visible and included in the layout when the viewport's content is larger than the viewport itself.
Try with
<s:Scroller width="100%" height="100%" horizontalScrollPolicy="on">
精彩评论