Keep Codename One components in invalid positions after app stop/resume

。_饼干妹妹 提交于 2019-12-06 20:35:32

When we come back from suspend or the device is rotated we need to layout the components into their natural place The only workaround to this is to disable the layout manager entirely by installing a fake one. This would essentially block layout from happening. I'm not sure if there is a valid use case for this, if it's just a visual animation there might be a better approach.

cnt.setLayout(new Layout() {
    @Override
    public void layoutContainer(Container parent) {
    }

    @Override
    public Dimension getPreferredSize(Container parent) {
        return new Dimension(getDisplayWidth(), getDisplayHeight());
    }
});
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!