【问题标题】:How do I hide/get rid the title bar on a Form? Codename One如何隐藏/删除表单上的标题栏?代号一
【发布时间】:2018-05-25 20:48:24
【问题描述】:

如何隐藏/删除表单上的标题栏?

我试图通过创建一个自定义的 Form 类并覆盖 shouldPaintStatusBar() 来做到这一点,但它不起作用。

整个代码是:

public class SplashScreenOp {
    private Resources theme;
    private Form splashForm;
    public Form getForm() {
        return splashForm;
    }

    public SplashScreenOp(Resources theme) {
        super();
        this.theme = theme;
    }

    public final void show() {
        splashForm = new Form(new BorderLayout());
        Image splashScreenImage = theme.getImage("splashscreen.png");
        ScaleImageLabel scaleImageLabel = new ScaleImageLabel(splashScreenImage);
        splashForm.add(BorderLayout.CENTER, scaleImageLabel);
        splashForm.show();
    }
}

因为这是一个启动页面,所以应该只显示图像。 IE。没有标题栏。

【问题讨论】:

    标签: codenameone


    【解决方案1】:

    我假设您在全球范围内使用Toolbar。您可以通过不添加任何 TitleCommand 并调用以下任一(或两者)来隐藏标题栏:

    splashForm.getToolbar().setUIID("Container");
    

    splashForm.getToolbar().hideToolbar();
    

    【讨论】:

    • 谢谢,成功了! (我不得不打电话给两者以使其正常工作。)
    【解决方案2】:

    您也可以调用:

    splashForm.removeComponent(splashForm.getTitleComponent());
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-10
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多