谁能告诉我为什么我的微调器没有出现?我正在做一个练习,但我不明白为什么我的旋转器根本没有显示任何物品。有什么建议么?
import android.app.Activity;
import android.os.Bundle;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
import android.view.Menu;
import android.view.View;
import android.widget.AdapterView;
import java.util.*;
public class Length extends Activity{
private Spinner spi1,spi2,cmbOpciones;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.length);
//Spinner1
List<String> imperialunits = new ArrayList<String>();
imperialunits.add("inch");
imperialunits.add("foot");
imperialunits.add("yard");
imperialunits.add("mile");
ArrayAdapter<String> adaptador = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, imperialunits);
spi1=(Spinner)findViewById(R.id.spinner1);
adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spi1.setAdapter(adaptador);
//Spinner2
final String[] SIunits =
new String[]{"km","m","cm"};
ArrayAdapter<String> adaptador2 = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, SIunits);
spi2 = (Spinner)findViewById(R.id.spinner2);
adaptador2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spi2.setAdapter(adaptador2);
//Spinner 3
final String[] datos = new String[]{"Elem1","Elem2","Elem3","Elem4","Elem5"};
ArrayAdapter<String> adaptador3 = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item, datos);
cmbOpciones = (Spinner)findViewById(R.id.CmbOpciones);
adaptador.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
cmbOpciones.setAdapter(adaptador3);
}
}