写android级联时,报错。Caused by: java.lang.RuntimeException: setOnItemClickListener cannot be used with a spinner.oid代码如下:sp_college.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { arrayAdapter=new ArrayAdapter<CharSequence>(MainActivity.this,android.R.layout.simple_spinner_item,college[i]); sp_college.setAdapter(arrayAdapter); } });
2 回答
弑天下
TA贡献1818条经验 获得超8个赞
spinnerView.setOnItemSelectedListener(
new OnItemSelectedListener() {
public void onItemSelected(AdapterView<?> parent,
View view, int position, long id) {
showToast("Spinner1: position=" position " id=" id);
}
public void onNothingSelected(AdapterView<?> parent) {
showToast("Spinner1: unselected");
}
});
希望对你有用
- 2 回答
- 0 关注
- 780 浏览
添加回答
举报
0/150
提交
取消