How to set the selected item color in the spinner?

android, spinner, xml

Solution

You need to create a custom spinner layout to achieve what you want.

check out these questions, they have the answers you want:

How to customize a Spinner in Android

Android: Custom Spinner Layout

The idea is to create a layout for your row, and set it when creating a spinner with its adapter in code.

Problem

``` <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?

Original source