本文介绍了setOnItemClickListener没有行为有微调的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
setOnItemClickListener没有行为有微调。这是我的code ...
supplier.setOnItemClickListener(新OnItemClickListener(){
@覆盖
公共无效onItemClick(适配器视图<>母公司视图中查看,INT位置,
长ID){
// TODO自动生成方法存根
。字符串msupplier = supplier.getSelectedItem()的toString();
Log.e(选择项,msupplier);
}
});
解决方案
setOnItemClickListener不会与微调工作。尝试使用这种方法:
更改code类似以下内容:
supplier.setOnItemSelectedListener(新OnItemSelectedListener(){
@覆盖
公共无效onItemSelected(适配器视图<>为arg0,查看ARG1,
INT ARG2,长ARG3){
// TODO自动生成方法存根
。字符串msupplier = supplier.getSelectedItem()的toString();
Log.e(选择项,msupplier);
}
@覆盖
公共无效onNothingSelected(适配器视图<>为arg0){
// TODO自动生成方法存根
}
});
setOnItemClickListener Not Works with Spinner. Here is my code...
supplier.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id) {
// TODO Auto-generated method stub
String msupplier=supplier.getSelectedItem().toString();
Log.e("Selected item : ",msupplier);
}
});
解决方案
setOnItemClickListener will not works with spinner. Try using this method:
Change your code like following:
supplier.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1,
int arg2, long arg3) {
// TODO Auto-generated method stub
String msupplier=supplier.getSelectedItem().toString();
Log.e("Selected item : ",msupplier);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});
这篇关于setOnItemClickListener没有行为有微调的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!