0

我希望我的 TabBar 能够显示左侧或右侧是否有更多菜单项。否则用户可能不知道存在更多选项。像箭头这样的东西来表示更多的项目,甚至在最后一个可见的选项卡项目上出现某种斜面效果,这样它就表明更多的选项不在屏幕上。这是我的 TabBar 的样子,带有一个箭头,显示了其他项目是如何被切断的: 在此处输入图像描述

这是 TabBarSkin 的代码:

public class ScollingTabBarSkin extends TabbedViewNavigatorTabBarSkin
{
    public var scroller:Scroller;

    /**
     *  Override createChildren() to create a Scroller and add the DataGroup
     *  as its viewport.
     */
    override protected function createChildren():void
    {
        super.createChildren();

        // use a standard HorizontalLayout instead of a specialized layout
        var tabLayout:HorizontalLayout = new HorizontalLayout();
        tabLayout.useVirtualLayout = false;
        tabLayout.gap = 0;
        tabLayout.variableColumnWidth = false;
        tabLayout.columnWidth = 400;

        dataGroup.layout = tabLayout;

        scroller = new Scroller();
        scroller.setStyle('interactionMode', InteractionMode.TOUCH);
        scroller.viewport = dataGroup;
        addChild(scroller);
    }

    /** 
     * Size and position the Scroller
     */
    override protected function layoutContents(unscaledWidth:Number, unscaledHeight:Number):void
    {
        setElementPosition(scroller, 0, 0);
        setElementSize(scroller, unscaledWidth, unscaledHeight);
    }
}

取自: http: //flexponential.com/2011/10/23/enable-scrolling-in-the-tab-bar-of-a-tabbedviewnavigator/comment-page-1/#comment-78685

4

0 回答 0