Android Action Bar are used in many applications, it is easy to implement and for consistency in UI design it offers user a familiar interface across applications.
Implement the overflow menu
Create a new Android project.
In the main activity class, inflate the menu which will adds the items to the action bar.
to handle the item select action rewrite the to do code in onOptionsItemSelected method:
in the res/menu/menu_main.xml add the optional items for selection:
Here is the simple overflow menu bar:
Add buttons to Action bar
Sometime buttons or other actions are needed outside the overflow menu, it is easy to add buttons on the action bar when
we already have the overflow menu.
add buttons in res/menu/menu_main.xml:
to handle the button onClick action add code in onOptionsItemSelected method:
This is how it looks like:
To build menu in action bar, first selection items need to be ready in menu xml file,
then add the items to action bar when Action created “onCreateOptionsMenu”, and finally handle the actions at