Reputation: 1309
I have a LWUIT Form which has 3 containers, each with its own content. Two commands('BackCommand' & 'ExitCommand') have been added to the form.
These commands are shown at the bottom of the screen. The commands hog up quite a lot of space on the screen. Can I auto hide these commands the way we can autohide a taskbar in windows?
Whenever the user pressed the left/right soft button, I want the two commands to pop-up and then become active for receiving events generated by the form.
How do I achieve this?
Upvotes: 1
Views: 351
Reputation: 52760
You need to derive the MenuBar
class introduced in LWUIT 1.5 and override the functionality of the menu bar any way you like e.g. setting the MenuBar to visible "false" within the form.
Upvotes: 1
Reputation: 19287
To hide the command's bar write in the class
of your Form
:
removeCommand(BackCommand);
removeCommand(ExitCommand);
To reshow the command
s you must overide the keyReleased(int keycode)
method and get the gameAction
of the key pressed by using Display.getInstance().getGameAction(keycode)
. To do this : first show the value of the gameAction of the two softbuttons in a Dialog, then in your if
test compare
the getGameAction
to these numbers.
Upvotes: 1