In fact, no tricks here do not need to do. Due to the fact that the API will enable the API-level> 11, the android will automatically form an action bar. Make out the menu in the usual way
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main_activity, menu); return true; }
and a menu description file
<?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_save" android:icon="@drawable/ic_menu_save" android:title="@string/menu_save" android:showAsAction="ifRoom|withText" /> </menu>
and you will action bar. The main point here is the different variations of the android: showAsAction attribute. With it, you can customize the display of a separate menu item (menu item, an action bar button with a picture / no picture, etc.) The selection of an item is caught in a standard callback.
And yes, you can find out more here ActionBar on developer.android.com