Flex 4 Scroller 组件不渲染水平滚动条

发布于 2024-09-16 09:00:55 字数 1299 浏览 10 评论 0原文

我很确定我的动态 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" 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>

I'm pretty sure my dynamic mxml layout must give me two scrollbars (horizontal and vertical) 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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

腹黑女流氓 2024-09-23 09:00:55

把Scroller里面的VGroup去掉或者改成Group!
使用 VGroup 作为第一个子级时,似乎不显示水平滚动条

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

信愁 2024-09-23 09:00:55

您尚未为 Scroller 设置 horizo​​ntalScrollPolicyverticalScrollPolicy,因此它们的值设置为 auto。本例中的行为是仅在必要时才显示滚动条。

滚动条根据 垂直和水平滚动条策略,可以是自动、打开或关闭。自动策略意味着当视口的内容大于视口本身时,滚动条将可见并包含在布局中。

尝试用

<s:Scroller width="100%" height="100%" horizontalScrollPolicy="on">

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">
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文