Codename One: Strange toolbar animation on form change

时间秒杀一切 提交于 2019-12-22 18:17:21

问题


Since adding a global Toolbar to the forms there is a strange animation bug (?) when changing forms. At hitting a Button at FormA that will invoke FormB.show() the title has an animation the lets the new form stutter in the toolbar area from the right to the left. After googling I found this:

This is pretty much the problem I face at the toolbar, only difference is the toolbar Logo I added to the center is stuttering from the right to the left to its place. After the animation is done, the form looks just like it should.

In the main I do this:

        Toolbar.setGlobalToolbar(true);

In every Form I do something like this in the constructor:

    menuForm = new Form(" ", new BorderLayout());
    logo = res_theme.getImage("Logo_Gema_vertikal.png");
    menuForm.getToolbar().getTitleComponent().setUIID("toolbar_image");
    ((Label)menuForm.getToolbar().getTitleComponent()).setIcon(logo);
    menuForm.getToolbar().addCommandToSideMenu(homeCommand);
    menuForm.getToolbar().getMenuBar().addCommand(homeCommand);

If I leave out adding the logo to the toolbar, only the Command Icons are flying from the right to the left. What is causing this? Am I using the toolbar wrong?


回答1:


From your question, it's due to using the default animation which is createSlideFadeTitle. You can solve this by changing the animation of the current form and the destination form to either createCover or createSlide:

In the current form:

currentForm.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 300));
nextForm.show();

And in the destination form:

nextForm.setTransitionOutAnimator(CommonTransitions.createSlide(CommonTransitions.SLIDE_HORIZONTAL, false, 300));
currentForm.showBack();


来源:https://stackoverflow.com/questions/43015925/codename-one-strange-toolbar-animation-on-form-change

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