I have a spinner inside a layout.
<Spinner android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:spinnerMode="dropdown"
android:id="@+id/spn_college_names"></Spinner>
I am setting it's value using Matrix Cursor and Simple Cursor Adapter as below spn_CollegeNames = (Spinner) findViewById(R.id.spn_college_names);
String[] ColoumnNames = {"_id","CollegeName"};
_CollegeNames = getResources().getStringArray(R.array.settings_college_names);
MatrixCursor cursor = new MatrixCursor(ColoumnNames);
for (int CollegeIndex = 0; CollegeIndex < _CollegeNames.length; CollegeIndex++ )
{
cursor.addRow(new Object[] {CollegeIndex+1 , _CollegeNames[CollegeIndex]});
}
SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(getApplicationContext(), android.R.layout.simple_spinner_dropdown_item, cursor, new String[] {"CollegeName"}, new int[] {android.R.id.text1},0 );
/*TextView tv = (TextView) spn_CollegeNames.getSelectedView();
tv.setTextColor(Color.BLACK);*/
spn_CollegeNames.setAdapter(cursorAdapter);
My problem now is that the text in the spinner is appearing in gray color. I want to change the text to black. I know I can use android:enteries attribute in the layout but I will be replacing the matrix cursor with database cursor in future which means I will not have fixed string array values.