2
任何人都可以建議如何清除按鈕上的微調值?按鈕上的清除微調按下
Spinner spinner1;
private static final String[] SpinArray= { "00", "01", "02",
"03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13",
"14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "00" };
adapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item,
SpinArray);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinner1.setAdapter(adapter);
spinner1.setOnItemSelectedListener(new mySpinnerListener());
public void onItemSelected(AdapterView parent, View v, int position,
long id) {
// TODO Auto-generated method stub
switch(parent.getId()){
case R.id.spinner1:
spinner1=parent.getSelectedItem().toString();
break;
}
上按一下按鈕我試圖使用
spinner1.setAdapter(null); and spinner1.setOnItemSelectedListener(null);
這兩個並沒有我的情況下工作,以清除..請幫助
此後,您也可能需要調用'.notifyDataSetChanged()'。 – Eric 2012-07-28 17:32:29
對於Spinner,不贊成使用notifydatasetchanged。 – 2014-01-02 22:34:31
沒有任何方法.clear() – SAndroidD 2014-08-08 10:41:24