我有一个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;
} in在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);不是的。很好。
有什么想法吗?
发布于 2014-03-17 13:43:11
遇到了同样的问题。这里来自adobe论坛,可能需要等待apache flex的真正修复:
该问题是基于延迟的错误( http://bugs.adobe.com/jira/browse/FLEXDMV-1656)造成的。有几种解决方法,但最简单的是在LegendItem类型选择器上设置fontSize,如下所示:
<mx:Style>
LegendItem {
fontSize:24;
}
</mx:Style> https://stackoverflow.com/questions/11161510
复制相似问题