來自搜索命令的操作不起作用,但來自溢出菜單的操作仍然有效。搜索命令不能與Codenameone中的溢出菜單結合使用
這是我的代碼
getToolbar().addSearchCommand(e -> {
String text = (String) e.getSource();
if (text == null || text.length() == 0) {
this.undoSearch(this);
} else {
this.fetchComponents(this, text);
}
getContentPane().animateLayout(150);
this.revalidate();
this.repaint();
}, 4);
getToolbar().addCommandToOverflowMenu("Enviar", null, (ActionListener) (e) -> {
Display.getInstance().scheduleBackgroundTask(() -> {
boolean success = this.appView.getService().updateTicket(ticket);
if (success) {
this.appView.showSuccess("Enviado com sucesso!");
} else {
this.appView.showError(new Exception("Ocorreu algum erro ao enviar!"));
}
});
});
我只想做samething喜歡它:

什麼不起作用?請注意,當您單擊搜索按鈕時,標題將替換爲應該輸入查詢的文本字段,這是否會發生? –
不,它不會發生,當我添加搜索命令,並在稍後,OverflowMenu –