我希望我的 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);
}
}