在我的主题文件中,我有以下代码来更改微调器的下拉颜色:
<resources>
<style name="AppBaseTheme" parent="android:Theme.Light">
</style>
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:dropDownListViewStyle">@style/DropDownListView</item>
</style>
<style name="DropDownListView" parent="@android:style/Widget.Holo.DropDownItem.Spinner">
<item name="android:background">@color/white</item>
<item name="android:textAppearance">@style/CustomActionOverflowDropDownText</item>
</style>
<style name="CustomActionOverflowDropDownText" parent="@android:style/Widget">
<item name="android:textColor">@color/black</item> <!--This does not work-->
</style>
</resources>
但是,文字颜色不会改变。有没有办法解决这个问题?
答案 0 :(得分:0)
我刚刚通过覆盖getDropDownView
中的ArrayAdapter
找到了如何做到这一点:
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView text = (TextView) view.findViewById(android.R.id.text1);
text.setTextColor(Color.BLACK);
return view;
}