使列表中的滚动条不可见

时间:2011-09-01 17:33:54

标签: flex listview scrollbar flex4.5

我正在使用Adobe FLEX 4.5.1 for Mobile。

我有一个显示一些图像的列表:

<s:List id="imageList" initialize="init()" verticalScrollPolicy="off"     itemRenderer="skins.CustomIconItemRenderer" width="100" height="32" verticalCenter="0" horizontalCenter="0">
    <s:layout>
        <s:HorizontalLayout>
        </s:HorizontalLayout>
    </s:layout>
</s:List>


我想让水平滚动条不可见,但仍然可以滚动。

我在ActionScript中尝试了这个:

imageList.scroller.horizontalScrollBar.visible=false;
imageList.scroller.horizontalScrollBar.alpha=0;
imageList.horizontalScrollPolicy= ScrollPolicy.OFF;
没有运气。

1 个答案:

答案 0 :(得分:0)

<fx:Metadata>
<![CDATA[ 
    /** 
     * @copy spark.skins.spark.ApplicationSkin#hostComponent
     */
    [HostComponent("spark.components.Scroller")]
]]>
</fx:Metadata> 

<fx:Script>
<![CDATA[    
    /**
     *  @private
     */
    override public function beginHighlightBitmapCapture() : Boolean
    {
        var needUpdate:Boolean = super.beginHighlightBitmapCapture();

        // Draw an opaque rect that fill our entire skin. Our background
        // is transparent, but we don't want focus/error skins to
        // poke through.  This is safe to do since we don't have any 
        // graphic elements as direct children.
        graphics.beginFill(0);
        graphics.drawRect(0, 0, width, height);
        graphics.endFill();

        return needUpdate;
    }

    /**
     *  @private
     */
    override public function endHighlightBitmapCapture() : Boolean
    {
        var needUpdate:Boolean = super.endHighlightBitmapCapture();

        // Clear the rect we drew in beginBitmapCapture();
        graphics.clear();

        return needUpdate;
    }
]]>
</fx:Script>

<!---  A vertical scrollbar that lets you control the portion of data that is displayed 
        when there is too much data to fit vertically in a display area.
        The Scroller determines whether the vertical ScrollBar is visible. -->
<!--<s:VScrollBar id="verticalScrollBar" visible="false" />-->

<!---  A horizontal scrollbar that lets you control the portion of data that is displayed 
        when there is too much data to fit horizontally in a display area.
        The Scroller determines whether the horizontal ScrollBar is visible. -->
<!--<s:HScrollBar id="horizontalScrollBar" visible="false" />-->