解决方案 »


  1.                  Spinner spinner = (Spinner) findViewById(R.id.spinner);
    ArrayAdapter<String> aa = new ArrayAdapter<String>(this,
    android.R.layout.simple_spinner_item, items);
    aa.setDropDownViewResource(android.R.layout.simple_spinner_item);
    spinner.setAdapter(aa);
    spinner.setOnItemSelectedListener(new OnItemSelectedListener() {

    public void onItemSelected(AdapterView<?> parent, View view,
    int position, long id) {
    //selection.setText(items[position]);
    selection.setText(position+ ""); } public void onNothingSelected(AdapterView<?> parent) {
    if(selection != null){
    int item = Integer.parseInt(selection.getText().toString().trim());
    spinner.setSelection(0, false);
    spinner.setSelection(item, true);
    }
    } });
      

  2. 补充一点:点击后就只Spinner的背景色变一下,其它都木有了
      

类似问题 »