我在EditText中獲得默認值,即使我沒有選擇從微調尚未。任何人都可以幫我嗎?Android:錯誤的onItemSelected爲微調
public void onItemSelected(AdapterView<?> parent, View v, int position,
long id) {
// TODO Auto-generated method stub
etCountry.setText("");
switch(parent.getId()){
case R.id.spcountry:
etCountry.setText(parent.getItemAtPosition(position).toString());
break;
}
}
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
etCountry.setText("");
}
下面是一些很好的答案: http://stackoverflow.com/questions/4726490/android-set-spinner-default-value-to-null –
你正在嘗試與開關盒呢? – gowri
實際上我總共有4個Spinner.That y我正在使用switch&some us if/else。 –