Codenameone 单形式跃迁效应

Codenameone 单形式跃迁效应,codenameone,Codenameone,我有一张表格。我希望表单在内容更新时看起来像是正在转换到其他表单 我只有一个表单,它的内容得到更新,并且希望有一个过渡效果,就好像我正在移动到另一个表单一样。谢谢 Label instruction = new Label(); ImageViewer v = new ImageViewer(); instruction.setText(levels.nextS()); v.setImage(levels.nextI()); Button b =

我有一张表格。我希望表单在内容更新时看起来像是正在转换到其他表单

我只有一个表单,它的内容得到更新,并且希望有一个过渡效果,就好像我正在移动到另一个表单一样。谢谢

    Label instruction = new Label();
    ImageViewer v = new ImageViewer();

    instruction.setText(levels.nextS());
    v.setImage(levels.nextI());



    Button b = new Button("Submit");



    b.addActionListener(x -> {

        instruction.setText(levels.nextS());
        v.setImage(levels.nextI());

        current.animateHierarchy(300);
        current.show();

    });

    current.add(FlowLayout.encloseCenter(score));
    current.add(FlowLayout.encloseCenter(instruction));

添加内容后,可以调用
animatehirachy
animateLayout

myForm.add(cmp);
myForm.animateHierarchy(300);

myForm
替换为您要将内容添加到的容器。

谢谢,我今天一定会尝试它。它部分起作用。在标签上看到一些动画,但是单选按钮和ImageView没有动画…在这里发布一些代码片段,让我们了解您已经尝试过的内容。b是一个按钮。指令是一个标签,v是ImageViewer,下面是代码。b、 addActionListener(x->{instruction.setText(levels.nextS());v.setImage(levels.nextI());current.animateHierarchy(300);})如果我从表单中删除所有内容,然后再次删除所有内容,我认为它可以工作,但这是对CPU周期的浪费