Codenameone refresh list of images without reloading the page

隐身守侯 提交于 2019-12-04 18:02:47

This is actually pretty simple to do with a BoxLayout.Y_AXIS Container. When you create an image component to add to the box layout do this:

myImageComponent.putClientProperty("imageId", imageId);

Then when you have the callback to refresh the list just do something like this:

for(Component cmp : parentContainer) {
    String id = (String)myImageComponent.getClientProperty("imageId");
    if(!existsInNewList(id)) {
       cmp.remove();
    }
}

When you are done updating the container just call animateLayout(200) or revalidate() to refresh the UI.

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