public class MainActivity extends AppCompatActivity { private TextView text; private Spinner spinner; private SimpleAdapter adapter; private List<Map<String,Object>> data; private String[] place = {"北京","上海","深圳","佛山"}; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //注册控件 text = (TextView)findViewById(R.id.txt); spinner=(Spinner)findViewById(R.id.spinner); //数据源 data = new ArrayList<Map<String,Object>>(); getdata(); //适配器 adapter = new SimpleAdapter(this,data,R.layout.item,new String[]{"pic","txt"},new int[]{R.id.picture,R.id.name}); adapter.setDropDownViewResource(R.layout.item); spinner.setAdapter(adapter); spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { text.setText("您选择的是:" + adapter.getItem(position)); } @Override public void onNothingSelected(AdapterView<?> parent) { text.setText("None"); } }); } private void getdata() { for(int i= 0; i < place.length; i++){ Map<String,Object> map = new HashMap<String, Object>(); map.put("pic",R.drawable.address_book); map.put("txt",place[i]); data.add(map); } }