I have a spinner in which I would like to have the text of each item be a different color. for example on item0 the text should be red, item1 the text should be blue, and item2 the text should be green. I tried setting the item I want to change to a textView and changing the color of the textview but it does not work that way. any ideas on how to acomplish this task?
Spinner spinner = (Spinner) findViewById(R.id.spinner1);
ArrayList<String> array = new ArrayList<String>();
array.add("item0");
array.add("item1");
array.add("item2");
ArrayAdapter<String> spinnerArrayAdapter = new ArrayAdapter<String>(this,R.layout.row, array);
spinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner.setAdapter(spinnerArrayAdapter)
try{
TextView tv = new TextView((Context) spinner.getItemAtPosition(0));
tv.setTextColor(Color.argb(0, 255, 0, 0));
}catch(Exception e){
Toast.makeText(getApplicationContext(), "Error: " + e.toString(), Toast.LENGTH_LONG);
}