2013-04-05 42 views

回答

0

欢迎SO。你绝对应该阅读FAQ以了解要问什么样的问题以及如何。如果你想得到很好的答案并且不希望你的特权被撤销,你需要对你的问题更加具体,并添加相关的代码和错误消息以表明你已经尝试过。但既然你是新人,我会给你这个。要做到这一点最简单的方法是听众重视各一onCreate()通过你的XML让每个spinner参考后

spinner1.setOnItemSelectedListener(this); 
spinner2.setOnItemSelectedListener(this; 

然后把外面的onCreate()

@Override 
public void onItemSelected(AdapterView<?> parent, View view, int arg2, 
     long arg3) 
{ 
    // do whatever you need here depending on what is selected 
    // you can use a case statement and switch on the id to get the spinner (parent) or view 

} 

@Override 
public void onNothingSelected(AdapterView<?> arg0) { 
    // TODO Auto-generated method stub 

} 

的方法和添加Implements OnItemSelectedListener在您的Activity签名。祝你好运,请在将来提出更具体的问题,并添加代码表明你已经做出了尝试。