How to set the selected item color in the spinner?

Viewed 16147
<Spinner
     android:id="@+id/spinner1"
     android:layout_width="match_parent"  
     android:layout_height="wrap_content"   
     android:layout_alignLeft="@+id/editText1F"
     android:layout_alignTop="@+id/txtLabel1F" 
     android:entries="@array/cat_array"  
     android:prompt="@string/cat_promt" 
     android:textColor="#ffffff"                            
   />

My Background is black and the item showing is with gray bg and black font color. But when it come to the selected it shows the font as black so it is not being seen. How do I change the color in it?

3 Answers

Simplest use this

use this to change the text of selected Text

YOUR_SPINNER.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
     TextView selectedText=  view.findViewById(R.id.text_view_name_in_Adapter);
     selectedText.setTextColor(getResources().getColor(R.color.YOUR_COLOR));
    }
}
Related