6

在我的应用程序中有一个按钮,单击该按钮时会弹出上下文菜单。如何避免显示上下文菜单?

protected void makeMenu(Menu menu, int context){
    menu.add(_imageMenuItem);
    super.makeMenu(menu, context);
}

class ImageMenuItem extends MenuItem {      
    ImageMenuItem() {
        super("Login Screen", 0, 0);            
    }
    public boolean onMenu(int i) {
        return false;
    }

    public void run() {
        UiApplication app = (UiApplication) getApplication();
        app.pushScreen(new LoginScreen());
    }
}
4

1 回答 1

16

您是否通过构造函数向 ButtonField 添加了样式?

ButtonField button = 
    new ButtonField("text", Field.H_CENTRE|ButtonField.CONSUME_CLICK);
于 2011-02-07T11:29:18.347 回答