下拉列表控件Spinner
[main.xml]
<LinearLayout>
<spinner
android:id=”@+id/spinner1”
Android:layout_width=”fill_parent”
Android:layout_height=”wrap_content”
/>
</LinearLayout>
[Activity_main.java:]
public void onCreate(Bundle saveInstanceState){
super.onCreate(savaInstanceState);
setContetentView(R.layout.main);
Spinner spinner1=(Spinner)findViewById(R.id.spinner1);
String[] applicationNames=new String[]{“1”,”2”,”3”,”4”,”5”}
ArrayAdapter<String> aaAdapetr=new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item,applicationNames);
//将ArrayAdapter对象与spinner1绑定
Spinner1.setAdapter(aaAdapter)
}