【问题标题】:how to set MX Panel title back color如何设置 MX Panel 标题背景颜色
【发布时间】:2014-08-09 14:23:43
【问题描述】:

我想设置 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;
    }

请帮我设置标题颜色。

谢谢 卡皮尔

【问题讨论】:

    标签: css actionscript-3 air panel


    【解决方案1】:

    你试过背景颜色吗?它适用于我的 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");
        }
    

    【讨论】:

    • 是的,我试过了,但没用。你能把示例代码发给我吗?我在 AIR 中做。
    • 我没有仔细阅读你的问题,所以我误解了你。所以我更新了我的答案。
    • 嘿!你很棒!它对我有用。太感谢了。实际上,我是一名 .Net 开发人员和 Windows Azure 架构师。但现在正在开发小型 Adob​​e Air 应用程序。我向你致敬。
    • 很高兴它对您有所帮助 =)
    猜你喜欢
    • 1970-01-01
    • 2011-08-03
    • 2021-05-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多