LWUIT形式的左右命令菜单 [英] left and right command menus in LWUIT form

查看:85
本文介绍了LWUIT形式的左右命令菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用LWUIT框架开发移动应用程序. 默认情况下,在LWUIT中,第一个命令放在窗体的左侧,随后的命令将放在窗体的右侧菜单中,包括已经放在左窗体中的命令.我需要在窗体中添加两个菜单.左菜单包含特定于常规应用程序的菜单命令,例如最小化",返回"和退出".右菜单包含特定于屏幕的命令,例如播放音频",播放视频"等.表单的最初左软键包含文本选项",而表单的右软按钮包含文本菜单".当用户选择选项"时,将显示带有以下命令的菜单: 最小化 后退 出口 当用户选择右软键菜单"时,将显示一个菜单,其中包含特定于屏幕的命令: 播放音讯 播放视频等... 右菜单的命令不断从一种形式更改为另一种形式,而左菜单的命令对于所有屏幕(形式)均保持相同.我知道可以通过覆盖返回一个列表的"Form.createCommandList(Vector)"来自定义命令菜单.但是在我的情况下,我需要两个列表(菜单).一个在表格的左边,另一个在表格的右边.请帮我解决这个问题.

Using LWUIT framework to develop mobile application. In LWUIT by default first command is placed in the left and subsequent commands will be placed in the right menu of the form including the command which is already placed in form left.I need to add two menus to form.Left menu contains general application specific commands such as "Minimize","Back" and "Exit". Right Menu contains screen specific commands such as "Play Audio","Play Video" etc... Initially left softbutton of the form contains the text "Options" and the right softbutton of the form contains the text "Menu". When user selects "Options", a menu will be displayed with the following commands: Minimize Back Exit When user selects right soft button "Menu", a menu will be displayed with screen specific commands: Play Audio Play Video etc... Commands of the right menu keeps changing from one form to another form, whereas the commands of left menu remains the same for all screens(forms). I know command menu can be customized by overriding "Form.createCommandList(Vector)" which returns a list. But here in my case I need two lists(menus). One at the left of the form and the other one at the right of the form.Please do help me in resolving this issue.

推荐答案

LWUIT菜单只是一个包含列表的对话框(或触摸菜单的按钮或几乎任何您想要的东西),因此要实现此功能,只需创建一个名为选项并将其放在左侧的软按钮中.当按下选项时,仅显示带有其他命令"的对话框.因为List可以接受命令数组或向量,所以做这样的事情真的很容易. 您可以查看MenuBar的代码,该代码非常简单,也可以替换最新版本的LWUIT(当前为SVN)中的菜单栏组件,但这对于该特定用例而言似乎是多余的.

A LWUIT menu is just a dialog containing a List (or buttons for touch menu or pretty much anything you want), so to implement this just create a Command called options and place it in the left soft button. When options is pressed just show the dialog with your "additional commands". Since a List can accept a command array or vector doing something like this can be really easy. You can look at the code for MenuBar which is pretty simple, you can also replace the menu bar component in the latest version LWUIT (SVN at the moment) but that seems redundant for this particular use case.

这篇关于LWUIT形式的左右命令菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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