侧面菜单抽屉图标消失问题 - codenameone

时间:2017-06-22 06:48:43

标签: codenameone

我在之前的屏幕中应用了animateLayout,这使得侧面菜单图标在其他屏幕中消失。如果我在启动画面中删除动画代码,问题就不存在了。如果出现此问题,侧面菜单将打开整个移动设备屏幕。

youtube here.

中查看问题

启动画面:

private void showSplashForm1() {

    Form splashForm = new Form(new BorderLayout(BorderLayout.CENTER_BEHAVIOR_CENTER));

    Container parentContainer = new Container(BoxLayout.y());
    splashForm.add(BorderLayout.CENTER, parentContainer);

    Label logoLabel = new Label(theme.getImage("logoMain.png").scaledWidth(screenWidth * 3 / 4));
    parentContainer.add(logoLabel);

    Label carLabel = new Label();
    Container carContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
    carContainer.add(carLabel);

    Image carImage = (Image) theme.getImage("car_static.gif");
    Timeline tcar = (Timeline) carImage;
    carLabel.setIcon(tcar);

    Label loadingLabel = new Label();
    loadingLabel.getAllStyles().setMarginBottom(250);
    loadingLabel.getAllStyles().setBgTransparency(0);
    loadingLabel.getAllStyles().setAlignment(Label.CENTER);

    Image loadingImage = (Image) theme.getImage("dots_min_time.gif");
    Timeline tloading = (Timeline) loadingImage;
    loadingLabel.setIcon(tloading);

    Container animateContainer = BoxLayout.encloseY(carContainer, loadingLabel);
    splashForm.add(BorderLayout.SOUTH, animateContainer);

    splashForm.show();
    splashForm.revalidate();

    //car animation starts
    carLabel.setX(-screenWidth);
    carLabel.setVisible(true);

    carContainer.animateLayout(4200);
    //car animation ends

    new UITimer(new Runnable() {
        public void run() {
            carLabel.setHidden(true);
            new Home(theme).show();

        }
    }).schedule(4000, false, splashForm);
}

主屏幕:

FontImage homeIcon = FontImage.createMaterial(FontImage.MATERIAL_HOME, style, 3);
Command home = new Command("  Home", homeIcon) {

    @Override
    public void actionPerformed(ActionEvent evt) {
        new Home(res).show();
    }
};
f.addCommand(home);

FontImage bookingIcon = FontImage.createMaterial(FontImage.MATERIAL_FILTER_NONE, style, 3);
Command booking = new Command("  Book", bookingIcon) {

    @Override
    public void actionPerformed(ActionEvent evt) {
        new Booking(res).show();
    }
};
f.addCommand(booking);
. . . . . . . . . . . . . . . . . . . . . . . . . . . 
. . . . . . . . . . . . . . . . . . . . . . . . . . . 
. . . . . . . . . . . . . . . . . . . . . . . . . . . 

1 个答案:

答案 0 :(得分:0)

我已经看到这与多个不同的边缘情况相关联。有一点发生这种情况是因为表单采用透明背景设计(我不知道为什么会触发这种奇怪的行为)。

这也可能是因为菜单图标大小计算错误所以定义主题常量:sideMenuSizeTabPortraitIntsideMenuSizePortraitIntsideMenuSizeTabLandscapeInt& sideMenuSizeLandscapeInt

如果你使用新的on-top mode这些事情不应该发生,但由于它是实验性的,我不确定它是否是正确的方向。