这就是我定义微调器的方式
s_province = (Spinner) findViewById(R.id.s_province);
ArrayAdapter<String> provinceAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, Data.provinces);
provinceAdapter
.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
s_province.setAdapter(provinceAdapter);
s_province.setOnItemSelectedListener(this);
我的类是从实现的OnItemSelectedListener
,我覆盖了这个方法
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
// TODO Auto-generated method stub
switch (arg1.getId()) {
case R.id.s_province:
Log.d("here", "there");
break;
default:
break;
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
但是onItemSelect
没有触发,为什么?