Simple use of Android ActionBar and androidactionbar
ActionBar is actually Menu
1. Compile the menu interface in res/menu
<Menu xmlns: android = "http://schemas.android.com/apk/res/android">
<Item
Android: id = "@ + id/menu01"
Android: icon = "@ android: drawable/ic_menu_rotate"
Android: orderInCategory = "100"
Android: showAsAction = "always"
Android: title = "unread message"/>
<Item
Android: id = "@ + id/menu02"
Android: icon = "@ android: drawable/ic_menu_more"
Android: orderInCategory = "101"
Android: title = "more"
Android: showAsAction = "ifRoom | withText"/>
<Item
Android: id = "@ + id/menu03"
Android: icon = "@ android: drawable/ic_menu_add"
Android: orderInCategory = "102"
Android: showAsAction = "ifRoom | withText"
Android: title = "system settings"/>
<Item
Android: id = "@ + id/menu04"
Android: icon = "@ android: drawable/ic_menu_delete"
Android: orderInCategory = "103"
Android: showAsAction = "ifRoom | withText"
Android: title = "Advanced Settings"/>
<Item
Android: id = "@ + id/menu05"
Android: icon = "@ android: drawable/ic_menu_help"
Android: orderInCategory = "104"
Android: showAsAction = "ifRoom | withText"
Android: title = "help"/>
</Menu>
2. Get ActionBar in Activity
AB = getActionBar (); // get actionBar
AB. setTitle ("");
AB. setDisplayHomeAsUpEnabled (true); // return to the previous interface
3. Reload onCreateOptionsMenu () to map menu. xml to menu, and reload onOptionsItemSelected () to operate the menu.
Code sample http://download.csdn.net/detail/wangdianyong/8541061