自定义组装中使用layout出错
自定义组建中使用layout出错
代码如下;
其中以Custom*打头的组建都是我自定义的,此时编译出错,错误信息为:
无法将“<s:layout>”解析为组件执行。
当我将“components:CustomNavigatorContent”替换为“s:NavigatorContent”时就没问题了,其中:
public class CustomNavigatorContent extends NavigatorContent
{}
请问这是为何,我该如何让自定义的CustomNavigatorContent也能进行布局?
------解决方案--------------------
这样修改试试 把s改为container
<container:SuperTabNavigator id="superTab" x="0" y="0" width="100%" height="100%">
<components:CustomNavigatorContent label="{rootTabName}" width="70%" height="100%">
<container:layout>
<container:VerticalLayout/>
</container:layout>
<components:CustomDataGrid width="100%" height="50%"/>
<components:CustomLineChart width="100%" height="50%"/>
</components:CustomNavigatorContent>
</container:SuperTabNavigator>
------解决方案--------------------
应该是没有此标签的,楼主换一种标签
------解决方案--------------------
<components:CustomNavigatorContent >
继承的哪个类,如果不是Spark容器类不起作用。
出现这种错误,我估计你的CustomNavigatorContent 是在MX组件基础上写的。所以出现这个错误。
可以在里面在加一层 <Group>
<components:CustomNavigatorContent >
<s:layout>
代码如下;
<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:components="com.syslink.components.*"
xmlns:container="flexlib.containers.*" width="100%" height="100%">
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
</fx:Declarations>
<container:SuperTabNavigator id="superTab" x="0" y="0" width="100%" height="100%">
<components:CustomNavigatorContent label="{rootTabName}" width="70%" height="100%">
<s:layout>
<s:VerticalLayout/>
</s:layout>
<components:CustomDataGrid width="100%" height="50%"/>
<components:CustomLineChart width="100%" height="50%"/>
</components:CustomNavigatorContent>
</container:SuperTabNavigator>
</s:Group>
其中以Custom*打头的组建都是我自定义的,此时编译出错,错误信息为:
无法将“<s:layout>”解析为组件执行。
当我将“components:CustomNavigatorContent”替换为“s:NavigatorContent”时就没问题了,其中:
public class CustomNavigatorContent extends NavigatorContent
{}
请问这是为何,我该如何让自定义的CustomNavigatorContent也能进行布局?
------解决方案--------------------
这样修改试试 把s改为container
<container:SuperTabNavigator id="superTab" x="0" y="0" width="100%" height="100%">
<components:CustomNavigatorContent label="{rootTabName}" width="70%" height="100%">
<container:layout>
<container:VerticalLayout/>
</container:layout>
<components:CustomDataGrid width="100%" height="50%"/>
<components:CustomLineChart width="100%" height="50%"/>
</components:CustomNavigatorContent>
</container:SuperTabNavigator>
------解决方案--------------------
应该是没有此标签的,楼主换一种标签
------解决方案--------------------
<components:CustomNavigatorContent >
继承的哪个类,如果不是Spark容器类不起作用。
出现这种错误,我估计你的CustomNavigatorContent 是在MX组件基础上写的。所以出现这个错误。
可以在里面在加一层 <Group>
<components:CustomNavigatorContent >
<s:layout>