问题
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