определить 2 xml: R.layout.spinner_item, R.layout.spinner_dropdown_item
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:ellipsize="marquee"
android:textSize="18sp" >
</TextView>
spinner_dropdown_item.xml
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="48dp"
android:ellipsize="marquee"
android:textSize="18sp" />
-------------------------------- Update -------------- ------------------------
код отдыха:
final ActionBar actionBar = getActivity().getActionBar();
RelativeLayout relative = new RelativeLayout(getActivity());
Spinner spinner = new Spinner(getActivity());
spinner.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
relative.addView(spinner);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(relative);
// Set adapter and listener
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, R.layout.spinner_item);
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);