1
votes

I'm trying to implement an Android style side menu and I'm having an issue implementing the rounded icon on top and labels below it before the sideCommands are added.

How do I implement this please?

1

1 Answers

2
votes

You can use Toolbar API which allows you to add components to the Sidemenu.

Have a look at Flickr demo.

Instead of using tool.addCommandToSideMenu(Command) you should use tool.addComponentToSideMenu(yourComponent, CommandToPerform)

Example:

@Override
protected void beforeMain(Form f) {
    //Store your commands before setting toolbar
    List<Command> cmds = new ArrayList();
    for (int i = 0; i < f.getCommandCount(); i++) {
        cmds.add(f.getCommand(i));
    }
    Toolbar toolbar = new Toolbar();
    f.setToolBar(toolbar);
    Label lblTitle = new Label("My Form", "Title");
    lblTitle.setEndsWith3Points(false);
    toolbar.setTitleComponent(lblTitle);

    // Use your stored commands after setting toolbar
    for (Command cmd : cmds) {
        toolbar.addCommandToSideMenu(cmd);
    }

    Container CustomContainer = ...
    toolbar.addComponentToSideMenu(CustomContainer, new Command("") {

        @Override
        public void actionPerformed(ActionEvent evt) {
            //What CustomContainer should do (if any)
        }
    });
    f.revalidate();
}