Spinner drop down menu items color (Android)

Rohit Deshmukh picture Rohit Deshmukh · Oct 1, 2012 · Viewed 12.8k times · Source

So I have a spinner and I was successful in changing the color of the selected item but I am not able to change the color of the items in the drop down menu

This is my spinner_layout.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView  
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="fill_parent" 
   android:layout_height="wrap_content"
   android:textSize="13sp" 
   android:textColor="#33CCFF"         
/>

and this is my styles.xml

<resources>
  <style name="AppTheme" parent="android:Theme.Light" >
     <item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem.Color</item>
     <item name="android:spinnerItemStyle">@style/SpinnerItem</item>
  </style>
  <style name="SpinnerItem.DropDownItem.Color" parent="@android:style/Widget.DropDownItem.Spinner">
      <item name="android:textColor">#4FBDE8</item>
  </style>

  <style name="SpinnerItem" parent="@android:style/Widget.TextView.SpinnerItem">
      <item name="android:textColor">#4FBDE8</item>
  </style>
</resources>

is there an XML way I can do it in ?

Answer

DroidT picture DroidT · Oct 29, 2012

Here is the solution I found on another stackoverflow thread

<style name="Theme.NoTitleBar.WithColoredSpinners" parent="@android:style/Theme.NoTitleBar">
    <item name="android:spinnerItemStyle">@style/SpinnerItem</item>
    <item name="android:spinnerDropDownItemStyle">@style/SpinnerItem.DropDownItem</item>
</style>

<style name="SpinnerItem" parent="@android:style/Widget.TextView.SpinnerItem">
    <item name="android:textColor">#00FF00</item>
</style>

<style name="SpinnerItem.DropDownItem" parent="@android:style/Widget.DropDownItem.Spinner">
    <item name="android:textColor">#FF0000</item>
</style>