I'm using this library for spinner. I want to change the color of already selected items from the list in the spinner. How can I do it? This is how I'm populating the data onclick of the spinner:
spinner1.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_UP) {
Cursor crs = database.rawQuery("SELECT * FROM "+ ItemsTable.TABLE_ZONE +" WHERE "+ ItemsTable.COLUMN_ZONE_ID +"<>"+ zone_id1
+" AND "+ ItemsTable.COLUMN_ZONE_ID +"<>"+ zone_id2 +" AND "+ ItemsTable.COLUMN_ZONE_ID +"<>"+ zone_id3 +"", null);
Integer[crs.getCount()];
List<Zone> listOfZones = new ArrayList<Zone>();
while(crs.moveToNext())
{
String title = crs.getString(crs.getColumnIndex("title"));
Integer title_id = crs.getInt(crs.getColumnIndex("id"));
listOfZones.add(new Zone(title_id, title));
}
crs.close();
ArrayAdapter<Zone> zoneadapter = new ArrayAdapter<Zone>(getActivity(),
android.R.layout.simple_dropdown_item_1line, listOfZones);
spinner1.setAdapter(zoneadapter);
}
return false;
}
});
In the code above I'm removing the items from the list which are already selected but I want to change the background color of the items already selected.