Bit annoying that I've just done it, but here is a method of doing it using the built-in Spinner in the action bar. All you need to do is make your spinner item's main container a RelativeLayout
and set its gravity to fillHorizontal, like so:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="fill_horizontal"
android:orientation="vertical" >
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginBottom="-4dip"
android:text="@string/gen_placeholder"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/TextView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@android:id/text1"
android:text="@string/app_name"
android:textAppearance="?android:attr/textAppearanceSmall" />
</RelativeLayout>
And initialising the Adapter as so:
ArrayAdapter<CharSequence> barAdapter = new ArrayAdapter<CharSequence>(this, R.layout.subtitled_spinner_item,
android.R.id.text1, getResources().getStringArray(R.array.actionList));
barAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
which then gives the required spinner spanning the entire actionbar (except for the action buttons):
