2013-04-05 29 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簽名。祝你好運,請在將來提出更具體的問題,並添加代碼表明你已經做出了嘗試。