Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spinner drop down menu items color (Android)

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 ?

like image 962
Rohit Deshmukh Avatar asked Oct 01 '12 20:10

Rohit Deshmukh


1 Answers

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>

like image 160
DroidT Avatar answered Oct 25 '22 02:10

DroidT