Friday, February 7, 2014

How to Create a Menu in Android Programming



1. Launch Eclipse. Right-click your project name and select 'New,' then 'Other,' then 'Android.' Click 'Android XML File' as the file type to start the menu wizard.

2. Click 'Menu' in the Type section of the wizard. Type a menu name for your XML file, such as 'menu.xml,' in the File text box. Click 'Finish.' A new menu item displays in your list of files.

3. Click the 'Item' option and select 'Add' to open the configuration window for a new menu item. Type the menu item information, such as the text shown to the user, the menu item's ID used in your Java source code, and whether the item is visible and enabled.

4. Click 'OK' to create the menu item. Click 'Save' to save the changes to your Android project. After you save the changes, click 'Run' to view the new menu in the Android emulator.

No comments:

Post a Comment