我有一个PieChart ......现在我也开始支持平板电脑了,我需要让传奇的fontSize更大。但是,以下内容无效:
<mx:Legend dataProvider="{industryChart}"
height="110" bottom="40"
height.groupTablets="220" bottom.groupTablets="80"
fontSize="8" fontSize.groupTablets="16"
markerHeight="10" markerHeight.groupTablets="20"
verticalGap="3"
/>
我知道状态是正确的,因为其他属性会发生变化。
我也尝试添加样式部分:
<fx:Style>
.legend {
fontSize:24;
}
</fx:Style>
<mx:Legend dataProvider="{industryChart}"
height="110" bottom="40"
height.groupTablets="220" bottom.groupTablets="80"
markerHeight="10" markerHeight.groupTablets="20"
verticalGap="3"
styleName="legend"
/>
没有变化。如果我将样式移动到Main.css也不行。
使用它会发出警告:组件中不支持CSS类型选择器:'mx.charts.LegendItem':
<fx:Style>
@namespace mx "library://ns.adobe.com/flex/mx";
mx|LegendItem {
fontSize:24;
}
</fx:Style>
但是如果我在Main.css中使用它,它确实有效:
@namespace mx "library://ns.adobe.com/flex/mx";
mx|LegendItem {
fontSize:24;
}
我遇到的问题是,我必须能够在平板电脑状态下使字体更大,而不仅仅是所有状态,或者手机上的字体太大。
伪选择器似乎不起作用:
mx|LegendItem:groupTablets {
fontSize:24;
}
ID在Main.cc或fx:Style:
中不起作用 #pieLegend {
fontSize:24;
}
<mx:Legend id="pieLegend"
dataProvider="{industryChart}"
height="110" bottom="40"
height.groupTablets="220" bottom.groupTablets="80"
markerHeight="10" markerHeight.groupTablets="20"
verticalGap="3"
/>
但是,即使该方法有效,当mxml背后的代码需要通过id引用特定组件时也会遇到困难。
我甚至感到沮丧并在代码中尝试了这个:
pieLegend.setStyle("fontSize", 24);
不。 GRRRR。
有什么想法吗?
答案 0 :(得分:1)
抓住了同样的问题。来自adobe论坛,可能需要等待apache flex才能获得真正的修复:
问题是基于延迟的错误(http://bugs.adobe.com/jira/browse/FLEXDMV-1656)。有几种解决方法,但最简单的是在LegendItem类型选择器上设置fontSize,如下所示:
<mx:Style>
LegendItem {
fontSize:24;
}
</mx:Style>