Flex:选项卡导航器选项卡位置

时间:2013-08-26 07:12:56

标签: flex layout tabs tabnavigator

我需要开发一个标签导航器,左侧有几个标签,右侧有一个标签,我已尝试过“tabOffset”属性,但这似乎无法提供帮助

enter image description here

提前致谢!

1 个答案:

答案 0 :(得分:3)

我制作了自定义TabNavigator组件。

package
{
import mx.containers.TabNavigator;
import mx.controls.Button;
import mx.events.FlexEvent;

public class CustomTabNavigator extends TabNavigator
{
    public function CustomTabNavigator()
    {
        super();
    }

    override protected function createChildren(): void
    {
        super.createChildren();
        tabBar.addEventListener(FlexEvent.CREATION_COMPLETE, addSpacer);
    }

    public function addSpacer(event: FlexEvent): void
    {
        var buttonCount: int = tabBar.getChildren().length;

        var _width : Number = this.width;
        var button: Button = tabBar.getChildAt(buttonCount-1) as Button;

        _width = _width - button.width;
        button.x = _width;
    }
}
}