写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);
}
});
リーリー
を使用できますsetOnItemSelectedListener