0
我以這種方式覆蓋微調器的行爲,將奇數和偶數顏色添加到下拉列表中。Android微調器行爲
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;
}
};
下拉列表看起來像我所期望的...但我鬆開按下每一行的亮點。 我忘了添加到代碼中? 感謝