Reputation: 19463
How to hide a tab in TabNavigator and also remove the empty space from it?
Example code:
<mx:TabNavigator id="TabNavigator">
<s:NavigatorContent id="tab1" label="Tab 1">
</s:NavigatorContent>
<s:NavigatorContent id="tab2" label="Tab 2">
</s:NavigatorContent>
<s:NavigatorContent id="tab3" label="Tab 3">
</s:NavigatorContent>
</mx:TabNavigator>
We can hide a tab via TabNavigator.getTabAt(1).visible = false;
. But this will left an empty space between Tab 1
and Tab3
. I don't want to use TabNavigator.removeChildAt(1);
because the program may need to show Tab 2
again.
So, how to temporary remove a tab in TabNavigator and also the empty space from it?
Thank you.
Upvotes: 2
Views: 2826
Reputation: 699
In action script you can do it. Just use id of navigatorcontent to set visible or includeinlayout. When you require make it true else make it false.
Default set to false. When you need make it true in AS.
<mx:TabNavigator id="TabNavigator">
<s:NavigatorContent id="tab1" label="Tab 1" visible="false" includeInLayout="false">
</s:NavigatorContent>
<s:NavigatorContent id="tab2" label="Tab 2">
</s:NavigatorContent>
<s:NavigatorContent id="tab3" label="Tab 3">
</s:NavigatorContent>
Upvotes: 2