0
如何使用多個紡紗在一個單一的佈局,即設置設定在項目中選擇監聽器上創建多紗廠setOnItemSelectedListener調用的OnCreate
如何使用多個紡紗在一個單一的佈局,即設置設定在項目中選擇監聽器上創建多紗廠setOnItemSelectedListener調用的OnCreate
歡迎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
簽名。祝你好運,請在將來提出更具體的問題,並添加代碼表明你已經做出了嘗試。
我的回答是否照顧你的問題? – codeMagic 2013-04-05 23:52:41