gpt4 book ai didi

codenameone - 手动触发 Pull 刷新容器

转载 作者:行者123 更新时间:2023-12-04 15:29:53 25 4
gpt4 key购买 nike

如果我想在加载表单后手动触发 Codename One 中的 Container 上的 Pull to Refresh。请告知是否有人有任何想法。

最佳答案

很简单,诀窍是使用 showListener .假设这是起始代码(取自 Codename One Developer Guide, section "Pull to refresh" ):

    Form hi = new Form("Pull To Refresh", BoxLayout.y());
hi.getContentPane().addPullToRefresh(() -> {
hi.add("Pulled at " + L10NManager.getInstance().formatDateTimeShort(new Date()));
});
hi.show();

要在加载表单后调用“Pull to Refresh”监听器,您可以这样做:
    Form hi = new Form("Pull To Refresh", BoxLayout.y());
Runnable myRunnable = () -> {
hi.add("Pulled at " + L10NManager.getInstance().formatDateTimeShort(new Date()));
};
hi.getContentPane().addPullToRefresh(() -> {
myRunnable.run();
});
hi.addShowListener(l -> {
myRunnable.run();
});
hi.show();

关于codenameone - 手动触发 Pull 刷新容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51183183/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com