`
fireflylover
  • 浏览: 107796 次
  • 性别: Icon_minigender_2
  • 来自: 武汉
社区版块
存档分类
最新评论

FLex3中弹出窗口包含TabNavigator时标签页的标题显示不完全的问题及解决方法

    博客分类:
  • FLEX
阅读更多

解决方法有3种:

1.增加样式activeTabStyle并设置字体不加粗。下面的代码为了统一标题的样式,也设置了TabNavigator的tabStyleName样式。

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" width="400" height="300" fontSize="12">
	<mx:Style>
		.tabStyle, .activeTabStyle
		{
			font-weight:normal
		}
	</mx:Style>
	<mx:Script>
		<!--[CDATA[
			import mx.managers.PopUpManager;
		]]-->
	</mx:Script>
	<mx:TabNavigator width="100%" height="100%" creationPolicy="all" tabStyleName="tabStyle">
		<mx:Canvas label="基本信息" width="100%" height="100%">
			<mx:Button x="39" y="10" label="按钮"/>
		</mx:Canvas>
		<mx:Canvas label="基信本息" width="100%" height="100%">
			<mx:Label id="msgLbl" x="39" y="10" text="标签"/>
		</mx:Canvas>
	</mx:TabNavigator>
	<mx:ControlBar horizontalAlign="right">
		<mx:Button id="closeBtn" label="Close" click="PopUpManager.removePopUp(this)"/>
	</mx:ControlBar>
</mx:Panel>

 

2.保证最后一个文本控件的字体是加粗的。如以上的代码如果TabNavigator的creationPolicy是默认的auto,则由于closeBtn默认是加粗的,因此可以不设置。如果creationPolicy是all,则必须保证最后一页的最后一个控件的字体是加粗的,也可以放一个不显示的Label,如

<mx:Label includeInLayout="false" visible="false" text="隐藏的Label" fontWeight="bold"/>
 

3.在第一个标签页的label后加一个空格,如

<mx:Canvas label="基本信息 " width="100%" height="100%">
 经试验,所需空格的数量标题的长度有关,当标题只有一个字时不用加空格,之后每增加4个字要加一个空格。

如果弹出窗口时不执行PopUpManager.centerPopUp(),或者不用弹出窗口、TabNavigator直接显示在Application中,此时TabNavigator显示出来后会再刷新一次从而显示正确的标题,因此不需做任何改动。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics