The options menu in Android will be displayed differently in the UI of your app depending on the value of android:targetSdkVersion that you set in AndroidManifest.xml. If android:targetSdkVersion is not set, or is set to a value less than 11, you will always get a grid of up to six menu items in one or two rows near the bottom of the screen. The Android documentation refers to this as the "traditional 6-item options menu". For example, this menu resource in res/menu/menu.xml:
<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android"><item android:id="@+id/menu_search"android:icon="@android:drawable/ic_menu_search"android:title="Go" /><item android:id="@+id/menu_bookmark"android:icon="@android:drawable/ic_input_get"android:title="Bookmarks" /><item android:id="@+id/menu_add"android:icon="@android:drawable/ic_menu_add"android:title="Add" /><item android:id="@+id/menu_delete"android:icon="@android:drawable/ic_menu_delete"android:title="Delete" /><item android:id="@+id/menu_save"android:icon="@android:drawable/ic_menu_save"android:title="Save" /><item android:id="@+id/menu_more"android:icon="@android:drawable/ic_menu_more"android:title="More" /></menu>
...and this method in YourActivity.java:
import android.view.Menu;
...
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.menu.menu, menu);
return true;
}
...will produce a similar UI in all versions of Android. Here are Android 1.5 Cupcake (API Level 3) and Android 4.2 Jelly Bean (API Level 17):

Showing the Action Bar on devices that support it (set android:targetSdkVersion ≥ 11)
Setting android:targetSdkVersion to a value of 11 or greater in your AndroidManifest.xml causes the Action Bar to appear on devices that support it. (Set it to at least 14 to ensure that the overflow action button never appears)
On Android 2.3.1 Gingerbread (API level 9), and other devices with API level < 11, the traditional 6-item options menu is displayed:

But on android devices with API level > 11, the Action Bar is shown and the menu is rendered as a vertical list of items. Here are Android 4.0 Ice Cream Sandwich (API level 14) with hardware menu button and Android 4.1 Jelly Bean (API level 16) without a hardware menu button:

Moving menu items into the Action Bar (set android:targetSdkVersion ≥ 11, add showAsAction="ifRoom")
Adding showAsAction="ifRoom" to a menu item will move it to the action bar if the device supports it and there's enough visual space on the screen. This attribute requires compiling your project with API level 11 or higher.
res/menu/menu.xml
<?xml version="1.0" encoding="utf-8"?><menu xmlns:android="http://schemas.android.com/apk/res/android"><item android:id="@+id/menu_search"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_menu_search"android:title="Go" /><item android:id="@+id/menu_bookmark"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_input_get"android:title="Bookmarks" /><item android:id="@+id/menu_add"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_menu_add"android:title="Add" /><item android:id="@+id/menu_delete"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_menu_delete"android:title="Delete" /><item android:id="@+id/menu_save"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_menu_save"android:title="Save" /><item android:id="@+id/menu_more"android:showAsAction="ifRoom"android:icon="@android:drawable/ic_menu_more"android:title="More" /></menu>
Android 1.5 Cupcake (API level 3) and other devices with API level < 11 continue to display the traditional 6-item options menu.

Devices with API level 11 or higher will show some the items that fit in the action bar, and show the rest of the items in the same vertical list as before. Here are Android 3.0 Honeycomb (API level 11), Android 4.0 Ice Cream Sandwich (API level 14) with hardware menu button, and Android 4.2 Jelly Bean (API Level 17) with no hardware menu button.

