2011-11-17 67 views
-1

在我的应用程序中,我想创建一个弹出式子菜单。我该怎么做呢?如何在黑莓应用程序中添加菜单项

+0

你能简单介绍一下你的需求吗? –

+0

我从数据库中获取数据,我想要在popmenu表单上显示我们可以选择的选项。 – Hasmukh

回答

2
MenuItem mymenu = new MenuItem("Categories" , 100, 10) 
{ 
    public void run() 
    { 
     //navigation purposes 
    } 
} 

调用此构造中

screen.addMenuItem(mymenu); 
4
//Menus: makeMenu Creates the menu and adds the items in Menu 
protected void makeMenu(Menu inMenu, int inInstance) 
{ 
    inMenu.add(showIt1); //inMenu adds the menuItems 
    inMenu.add(showIt2); 
    inMenu.add(showIt3); 
    super.makeMenu(inMenu, inInstance); 

/类扩展MainScreen(net.rim.device.api.ui.container。 MainScreen)。正如你可能猜到的那样,这是一个显示类。对于 BlackBerry应用程序,此类提供基本的显示功能,包括提供关闭菜单项的 。这是通过调用super()在构造函数 中实现的。/

} 

//Creates menuItems 

✓ “显示这1”:这是一个菜单项显示的文本。

✓50:该订购参数确定菜单中 项目在何处出现。较低的数字更接近 菜单的顶部。此外,在两个订单值相差65536或更多的MenuItems之间自动添加分隔条。

✓50:此值代表优先级,它决定哪个菜单项 可能会获得焦点。数字越小,焦点越多。

MenuItem showIt1 = new MenuItem("Show It 1", 50, 50) 
{ 
     public void run() 
     { 
      //Do whatever you want 
     } 
}; 

MenuItem showIt2 = new MenuItem("Show It 2", 100, 100) 
{ 
     public void run() 
     { 
      //Do whatever you want 
     } 
}; 

MenuItem showIt3 = new MenuItem("Show It 3", 150, 150) 
{ 
     public void run() 
     { 
      //Do whatever you want 
     } 
}; 

//End of Menu Creation 
+0

已弃用。 –

相关问题