我想设置 MX Panel 的背景颜色。我可以更改标题的文本颜色但不能更改背景颜色。
我正在使用下面的代码:
.Panel {
textAlign: center;
borderColor: #33cccc;
borderThicknessLeft: 6;
borderThicknessTop: 0;
borderThicknessBottom: 10;
borderThicknessRight: 6;
roundedBottomCorners: true;
cornerRadius: 8;
headerHeight: 22;
backgroundAlpha: 0.97;
highlightAlphas: 0.34, 0.06;
dropShadowEnabled: true;
shadowDistance: 8;
shadowDirection: left;
dropShadowColor: #5b3d24;
titleStyleName: "mypanelTitle";
}
.mypanelTitle {
background-color: #5b3d24;
color: #5b3d24;
background: #5b3d24;
fontFamily: Arial;
fontSize: 12;
fontWeight: bold;
}
请帮我设置标题颜色。
谢谢 卡 PIL
最佳答案
你尝试过 backgroundColor 吗?它适用于我的 mx:Panel (flex 4.6)。
更新:
对不起,我之前的回答不正确。如果您使用 Halo 主题,您可以尝试 headerColors 样式属性(我现在无法测试)。
第二种方式 - 为标题创建您自己的自定义皮肤。它将看起来像下一个:
Main.mxml
<mx:Panel x="428" y="21" width="250" height="200" layout="absolute" title="Title Text" titleBackgroundSkin="CustomTitleBackgroundSkin">
CustomTitleBackgroundSkin.as
package
{
import mx.core.UIComponent;
public class CustomTitleBackgroundSkin extends UIComponent
{
public function CustomTitleBackgroundSkin()
{
super();
}
override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
{
graphics.clear();
graphics.beginFill(0xff0000);
graphics.drawRect(0, 0, width, height);
graphics.endFill();
}
}
}
附言在 css 属性中,titleBackgroundSkin 将是下一个:
.panel {
titleBackgroundSkin: ClassReference("CustomTitleBackgroundSkin");
}
关于css - 如何设置 MX Panel 标题背景色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25219526/