知らなかったので、メモ。
要約としては、ArrayAdapter#setDropDownViewResource()
というのがあり、それにドロップダウン用のレイアウトをあててやるとよい。
SampleActivity.java
//onCreate内
//Spinner
mSpinner = (Spinner)findViewById(R.id.spinner);
ArrayAdapter arrayAdapter = ArrayAdapter.createFromResource(this, R.array.option_mode, R.layout.spinner_layout);
//SpinnerAdapterにはsetDropDownViewResourceというメソッドが無いので、ArrayAdapterにする
arrayAdapter.setDropDownViewResource(R.layout.spinner_dropdown_layout);
mSpinner.setAdapter(arrayAdapter);
spinner_layout
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="32dp"
android:layout_marginLeft="5dp"
android:paddingLeft="10dp"
android:textColor="@color/text_color_white"
android:textSize="@dimen/text_18sp"
android:background="@color/main_color"
/>
spinner_dropdown_layout.xml
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="@color/text_color_normal"
android:padding="10dp"
android:textSize="@dimen/text_18sp"
android:background="@color/background_color_white"
/>
こんな具合になります。