如何排列我们在菜单中添加的MenuItems
我编写了一个程序,在菜单中添加了一些选项。它成功添加了我插入的所有项目。现在我也安排好了所有的物品。但“切换应用程序”选项仍然位于顶部。我怎样才能改变它的位置?
MenuItem mi1 = new MenuItem("leave",0x00010004,0);
addMenuItem(mi1);
MenuItem mi2 = new MenuItem("importrouteplan",0x00020005,0);
addMenuItem(mi2);
MenuItem mi4 = new MenuItem("get5daysplan",0x00020005,0);
addMenuItem(mi4);
MenuItem mi3 = new MenuItem("gettodaysplan",0x00020005,0);
addMenuItem(mi3);
MenuItem mi6 = new MenuItem("stoptracktime",0x00030006,0);
addMenuItem(mi6);
MenuItem mi5 = new MenuItem("starttracktime",0x00030006,0);
addMenuItem(mi5);
I wrote a program that adds some options in the menu. It successfully added all the items that i inserted. Now i arranged all the items also. But the "switch application" option is still at the top. How can I change its position?
MenuItem mi1 = new MenuItem("leave",0x00010004,0);
addMenuItem(mi1);
MenuItem mi2 = new MenuItem("importrouteplan",0x00020005,0);
addMenuItem(mi2);
MenuItem mi4 = new MenuItem("get5daysplan",0x00020005,0);
addMenuItem(mi4);
MenuItem mi3 = new MenuItem("gettodaysplan",0x00020005,0);
addMenuItem(mi3);
MenuItem mi6 = new MenuItem("stoptracktime",0x00030006,0);
addMenuItem(mi6);
MenuItem mi5 = new MenuItem("starttracktime",0x00030006,0);
addMenuItem(mi5);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
事实证明这取决于操作系统级别。
例如,在 OS 4.7 上,“切换应用程序”始终位于底部“关闭”附近。但是,如果您在 OS 6 模拟器中打开任何本机 BB 应用程序,那么您会看到 RIM 更改了此行为 - “切换应用程序”始终位于顶部,而“关闭”则保留在底部。
所以基本上你的代码是完全可以的,你不需要改变它。但是,如果您确实需要将任何项目放在“Switch Application”上方,则可以使用相同的最顶层序数来完成:
请注意,尽管在这种情况下“Above Switch Application”位于“Switch Application”上方,但它共享相同的序数组 (0),因此两者之间不会有分隔符(我猜这在大多数情况下是不可接受的)。
Well, it turns out it depends on OS level.
For instance, on OS 4.7 "Switch Application" is always in the bottom section near the "Close". However if you open any native BB app in OS 6 simulator, then you'll see RIM changed the this behaviour - "Switch Application" is always in the top section while they left "Close" in the bottom.
So basically your code is fully Ok as is and you don't need to change it. However if you do need to put any item above the "Switch Application", then you can do it by using the same top-most ordinal:
Note despite in this case "Above Switch Application" IS above the "Switch Application", it shares the same ordinal group (0) so there will be no separator between the two (which I guess in not acceptable for the majority of the cases).
MenuItem 中的最后一个参数用于菜单中的优先级。
所以不要将其作为 0 传递
。菜单项的优先级。
值越低表示优先级越高,
相反,较高的值表示较低的优先级。
更改优先级并尝试。
The last argument in MenuItem is for Priority in the Menu.
So don't pass it as 0.
The priority of the menu item.
A lower value indicates a higher priority,
conversely a higher value indicates a lower priority.
Change the priority and try.