【问题标题】:custom style dialog box codenameone自定义样式对话框代号one
【发布时间】:2015-10-09 14:10:20
【问题描述】:

如何更改样式对话框...例如更改背景等非常令人困惑

 Dialog d = new Dialog();
            d.setUIID("abc");
            d.setDialogUIID("abc");
            d.getContentPane().setUIID("myDialog");
            Label popupOutfitSaved = new Label("There are no recent searches");
            popupOutfitSaved.setUIID("DialogLabel");
            d.setLayout(new BorderLayout());
            d.addComponent(BorderLayout.CENTER, popupOutfitSaved);
            d.setTransitionInAnimator(CommonTransitions.createFade(1000));
            d.setTransitionOutAnimator(CommonTransitions.createFade(800));
            d.getStyle().setOpacity(0);
            d.getStyle().setBgColor(0xff0000);  //why doesn't it work
            d.setTimeout(5000);
            d.showPopupDialog(c);

我也徒劳地改变了tintcolor

@Override
    protected void beforeMain(Form f) {
           f.setTintColor(0xccff99);
}

【问题讨论】:

    标签: codenameone


    【解决方案1】:

    setTintColor 之外,您所做的所有事情都无关紧要。

    setTintColor 是 AARRGGBB 颜色,而不是您列出的 RRGGBB 颜色。所以像:

    f.setTintColor(0x7fccff99);
    

    应该可以正常工作。

    【讨论】:

    • 非常感谢.. 使用 f.setTintColor(0x7fff0000) 时,整个屏幕都被 bg 颜色覆盖了,我们不能只在对话框中设置TintColor...??跨度>
    • TintColor 是在将对话框置于顶部之前在表单上覆盖的透明颜色。检查我的答案以获取想法。
    【解决方案2】:

    您需要设置 DialogBody、DialogTitle、DialogContentPane 和 Dialog UIID 的样式。在 GUI Builder 中执行此操作比在代码中更方便。

    【讨论】:

    • 有...并且可以在单击“添加新的 GUI 元素”时找到
    猜你喜欢
    • 2019-12-27
    • 2012-07-05
    • 1970-01-01
    • 1970-01-01
    • 2015-11-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多