How do I hide/get rid the title bar on a Form? Codename One

☆樱花仙子☆ 提交于 2019-12-23 18:47:41

问题


How do I hide/get rid the title bar on a Form?

I tried to do that by created a custom class of Form and override shouldPaintStatusBar() but it didn't work.

The entire code is:

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();
    }
}

As this is a splash page, so only the image should be displayed. ie. No title bar.


回答1:


I assume you are using Toolbar globally. You can hide title bar by not adding any TitleCommand and by calling either of below (or both):

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

:

splashForm.getToolbar().hideToolbar();



回答2:


You can also call:

splashForm.removeComponent(splashForm.getTitleComponent());


来源:https://stackoverflow.com/questions/42871223/how-do-i-hide-get-rid-the-title-bar-on-a-form-codename-one

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!