1
我正在爲我的微調器使用SpinnerAdpter,但我不知道如何在代碼中設置選擇。發現的答案沒有使用SpinnerAdapter,所以他們的解決方案對我無效。設置選擇Spinner(使用SpinnerAdapter)programaticaly。
這裏是我的適配器:
private class PackPricesAdapter extends BaseAdapter implements SpinnerAdapter {
@Override
public int getCount() {
return spinnerPackPrices.size();
}
@Override
public Object getItem(int position) {
return spinnerPackPrices.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View view, ViewGroup parent) {
TextView text = new TextView(mContext);
text.setText(spinnerPackPrices.get(position));
text.setTextSize(13f);
return text;
}
}
我想知道我可以設置一個選擇programaticaly