spinner 用的时候居然不是黑色白字就是 白色白字 很难看, 发现使用style不能解决, 于是就自定义了 其 adapter中的item的颜色
mVoteaddnew_deadline = (Spinner) getView().findViewById(R.id.voteaddnew_deadline);
ArrayAdapter<String> adapterdeadline = new ArrayAdapter<String>(getActivity(),
R.layout.voteaddnew_spinner_item, getResources().getStringArray(R.array.vote_addnew_spinner_array_time));
adapterdeadline.setDropDownViewResource(R.layout.voteaddnew_spinner_dropdown);
mVoteaddnew_deadline.setAdapter(adapterdeadline);
<string-array name="vote_addnew_spinner_array_time">
<item>一周</item>
<item>二周</item>
<item>三周</item>
<item>一月</item>
<item>三月</item>
<item>半年</item>
</string-array>
layout/voteaddnew_spinner_dropdown.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="fill_parent"
android:layout_height="45dp"
android:ellipsize="marquee"
android:textColor="#000"
android:background="#fff" />
layout/voteaddnew_spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="?android:attr/spinnerItemStyle"
android:singleLine="true"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:textAlignment="inherit"
android:textColor="#000" />
<Spinner
android:id="@+id/voteaddnew_votecategory"
android:layout_width="130dp"
android:layout_height="45dp"
>
</Spinner>
如此这般就可以随便定义spinner的字体和颜色了