MenuItems & ActionBars 1


 

  1. Static MenuItem
  2. Dynamic MenuItem
  3. Custom MenuItem
  4. Popup MenuItem
  5. MenuItems on Fragments
  6. ActionBar with Customizing
  7. ActionBar with UpNavigation
  8. ActionBar with SplitActions
  9. ActionBars with Custom Layout
  10. ActionBars wiht Refresh
  11. ActionBars with Search Widget
  12. ActionBars with Spinner Navigation

 

1. Static MenuItem
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> menu ->main.xml and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

menu menu2 menu3 menu4

Download_button

 

2. Dynamic MenuItem
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open AndroidManifest.xml and add following code :

ScreenShot:

dy_menu2 dy_menu3 dy_menu

Download_button

 

3. Custom MenuItem
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> menu ->main.xml and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

custom_menu3 custom_menu2 custom_menu custom_menu4

Download_button

 

4. Popup MenuItem
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> menu ->Create new xml, popup.xml and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

popup popup2 popup3 popup4

Download_button

 

5. MenuItems on Fragments
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class FragmentOne.java and add following code :

Step 5 : Open res -> layout -> Create new xml file, fragment_one.xml and add following code :

Step 6 : Open res -> menu -> main.xml and add following code :

Step 7 : Open res -> menu -> Create new xml file, frag_menu.xml and add following code :

Step 8 : Open AndroidManifest.xml and add following code :

ScreenShot:

menu_frag menu_frag2 menu_frag3 menu_frag4 menu_frag5 menu_frag6

Download SourceCode

 

5. ActionBar with Customizing
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, TransparentBarActivity.java and add following code :

Step 5 : Open res -> values -> styles.xml and and add following code :

Step 6 : Open res -> menu -> main.xml and add following code :

Step 7 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_custom2 action_custom3 action_custom4

action_custom5 action_custom6

Download SourceCode

 

7. ActionBar with UpNavigation
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open src -> package -> Create new class, .java and add following code :

Step 5 : Open res -> menu -> main.xml and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_up1 action_up2 action_up3

Download SourceCode

 

8. ActionBar with SplitActions
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open src -> package -> MainActivity.java and add following code :

Step 4 : Open res -> menu -> main.xml and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_split

Download SourceCode

 

9. ActionBar with Custom Layout
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout -> Create new xml, custom_actionbar_layout.xml and add following code :

Step 4 : Open src -> package -> MainActivity.java and add following code :

Step 5 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_custom

Download SourceCode

 

10. ActionBar with Refresh
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout -> Create new xml, action_progressbar.xml and add following code :

Step 4 : Open src -> package -> MainActivity.java and add following code :

Step 5 : Open res -> menu -> main.xml and add following code :

Step 6 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_refresh action_refresh2

Download SourceCode

 

11. ActionBar with Search Widget
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout -> Create new xml, .xml and add following code :

Step 4 : Open res -> layout -> Create new xml, activity_search_results.xml and add following code :

Step 5 : Open src -> package -> MainActivity.java and add following code :

Step 6 : Open src -> package -> Create new class, SearchResult.java and add following code :

Step 7 : Open res -> menu -> main.xml and add following code :

Step 8 : Open AndroidManifest.xml and add following code :

ScreenShot:

action_search2 action_searchaction_search3

Download SourceCode

 

12. ActionBar with Spinner Navigation
Step 1 : Select File -> New -> Project -> Android Application Project. Fill the forms, create “Blank Activity” and click “Finish” button.Step 2 : Open res -> layout -> activity_main.xml and add following code :

Step 3 : Open res -> layout -> Create new xml, nav_list_item_single.xml and add following code :

Step 4 : Open src -> package -> MainActivity.java and add following code :