I did this using another simple technique,
copy the simple_spinner_item.xml and simple_spinner_dropdown_item.xml from Android res/layout folder and copy them in your project.
Then modify the following lines
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, Android.R.layout.simple_spinner_item);
adapter.setDropDownViewResource(Android.R.layout.simple_spinner_dropdown_item);
spinnerSubject.setAdapter(adapter);
as:
ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this, R.array.planets_array, R.layout.simple_spinner_item);
adapter.setDropDownViewResource(R.layout.simple_spinner_dropdown_item);
spinnerSubject.setAdapter(adapter);
The rest is easy, you can now edit the simple_spinner_item.xml to edit the appearence of one visible item on the spinner widget, and edit the simple_spinner_dropdown_item.xml to change the appearance of drop down list.
For example,
my activity layout contains:
<Spinner
android:id="@+id/mo_spinnerSubject"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/spinnerset_background" />
and my simple_spinner_item.xml now contains:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:textColor="@color/custom_white"
android:textSize="16sp" />
and the simple_spinner_dropdown_item.xml looks like:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerDropDownItemStyle"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@color/custom_black"
android:ellipsize="marquee"
android:singleLine="true"
android:textColor="@color/custom_white" />