Native Back on Codenameone after using Toolbar class

▼魔方 西西 提交于 2019-12-23 02:55:10

问题


When I use the Toolbar class to customize my Toolbar for added functionality the native back command disappears, is there a way of getting it back?


回答1:


What do you mean disappear? This is how i use Toolbar API:

Toolbar t = new Toolbar();
myForm.setToolbar(t);
t.setTitle("My title");
Command back = new Command("back") {

   @Override
   public void actionPerformed(ActionEvent evt) {
       myForm.showBack();
   }
};
myForm.setBackCommand(back);
t.addCommandToLeftBar(back);

This will take care of both Android hardware back button and placing a back command at the top.

Note that you also have to style BackCommand UIID or allow it to use default, Just make sure the default color doesn't match the TitleArea color.



来源:https://stackoverflow.com/questions/34606515/native-back-on-codenameone-after-using-toolbar-class

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