使用工具栏类后,本机返回Codenameone [英] Native Back on Codenameone after using Toolbar class

查看:151
本文介绍了使用工具栏类后,本机返回Codenameone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用工具栏类来自定义我的工具栏以增加功能时,本机后退命令消失,是否存在找回它的方法?

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?

推荐答案

你的意思是什么消失?这就是我使用工具栏API的方式:

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);

这将处理Android硬件后退按钮并在顶部放置一个后退命令。

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

请注意,您还必须设置样式 BackCommand UIID或允许它使用默认值,只需确保默认颜色不' t匹配TitleArea颜色。

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.

这篇关于使用工具栏类后,本机返回Codenameone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆