如何排列我们在菜单中添加的MenuItems

发布于 2024-12-10 01:43:48 字数 691 浏览 0 评论 0原文

我编写了一个程序,在菜单中添加了一些选项。它成功添加了我插入的所有项目。现在我也安排好了所有的物品。但“切换应用程序”选项仍然位于顶部。我怎样才能改变它的位置?

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

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦途 2024-12-17 01:43:48

事实证明这取决于操作系统级别。

例如,在 OS 4.7 上,“切换应用程序”始终位于底部“关闭”附近。但是,如果您在 OS 6 模拟器中打开任何本机 BB 应用程序,那么您会看到 RIM 更改了此行为 - “切换应用程序”始终位于顶部,而“关闭”则保留在底部。

所以基本上你的代码是完全可以的,你不需要改变它。但是,如果您确实需要将任何项目放在“Switch Application”上方,则可以使用相同的最顶层序数来完成:

new MyMenuItem("Above Switch Application", 0 /*ordinal*/, 0);

请注意,尽管在这种情况下“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:

new MyMenuItem("Above Switch Application", 0 /*ordinal*/, 0);

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

冰雪之触 2024-12-17 01:43:48
MenuItem mi1 = new MenuItem("leave",0x00010004,0);

MenuItem 中的最后一个参数用于菜单中的优先级。

所以不要将其作为 0 传递

。菜单项的优先级。
值越低表示优先级越高,
相反,较高的值表示较低的优先级。

更改优先级并尝试。

MenuItem mi1 = new MenuItem("leave",0x00010004,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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文