私の質問に答えるには、次のようなものが必要です。
public class mySpinnerAdapter extends SimpleCursorAdapter implements SpinnerAdapter {
public OrderSpinnerAdapter(Context context, int layout, Cursor c, String[] from, int[] to) {
super(context, layout, c, from, to);
// TODO whatever you need
}
public View getDropDownView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(android.R.layout.simple_dropdown_item_1line, parent, false);
}
// TODO set the background color of the convertView
// depending on your wishes
return convertView;
}
}
このようにドロップダウン リストの作成を制御できるようにします。別のセレクターが必要な場合は、XML ファイルで簡単に行うことができます。
次に、単純にアダプターを作成し、メソッド setAdapter を使用してスピナーにバインドします。