I’m having an issue with the Droid X phones where users say that the font color turns out to be white in the spinner, making it invisible unless the users highlight the items. No other phones seem to have this problem. I was going to try to force the font to be black to see if that helps. How can I do that?
Here’s how I’m currently populating the spinner. It seems like the simple_spinner_item is broken on Droid X’s.
String spin_arry[] = new String[str_vec.size()];
str_vec.copyInto(spin_arry);
ArrayAdapter adapter =
new ArrayAdapter(this,android.R.layout.simple_spinner_item, spin_arry);
I’m going to use
Spinnerproject sample from Android SDK for next code examples.Code:
First, you need to create you custom adapter which will intercept the creation of views in drop down list:
Then you create adapter in your code like this:
Explanation:
Because
CustomArrayAdapterknows that we use android’s built-in layout resource, it also knows that text will be placed inTextViewwith idandroid.R.id.text1. That’s why it can intercept the creation of views in drop down list and change text color to whatever color is needed.Screenshot: