How to customize style from spinner dropdown CHOIC

2019-05-23 04:56发布

问题:

I can customize the background of the selected option on a spinner dropdown using:

<item name="android:spinnerStyle">@style/customSpinner</item>
<style name="customSpinner" parent="@android:style/Widget.Holo.Light.Spinner">
<item name="android:textColor">#000000</item>
<item name="android:background">#000000</item>
</style>

But I can't manage to change the background and textcolor of the list of options that the dropdown has. How do I achieve that?

回答1:

adapter.setDropDownViewResource(R.layout.custom_spinner);

custom_spinner.xml -

<?xml version="1.0" encoding="utf-8"?>
<TextView
  xmlns:android="http://schemas.android.com/apk/res/android"
  parent="@android:style/TextAppearance_Widget_DropDownItem"
  android:textColor="#988767"
>
</TextView>