I overwrite the behavior of a spinner, to add odd and even colors to the drop down list, in this way.
SimpleCursorAdapter productsListAdapter = new SimpleCursorAdapter(MyActivity.this, R.layout.spinner_drop_down_products, cursor, column, viewIds) {
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
View view = super.getDropDownView(position, convertView, parent);
if (position % 2 == 0) {
view.setBackgroundColor(android.graphics.Color.rgb(255, 255, 255));
} else {
view.setBackgroundColor(android.graphics.Color.rgb(214, 214, 214));
}
return view;
}
};
The dropdown rows look as i expected ... but i loose the highlight on pressing each row. What i forget to add to the code? Thanks