@Override
    public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {

方法1:通过ArrayAdapter 提供的getItem(position) 直接获取位置内容
        String cityname = adapter.getItem(position);
        text.setText("您选择的地方是:" + cityname);
方法2:在一开始初始化数据源 时 用数组来定义 通过数组下标配合position来找
        text.setText("您选择的地方是:" + place[position]);
方法3:通过list提供的  list.get(position) 直接获取位置内容
        String cityname = data.get(position);
        text.setText("您选择的地方是:" + cityname);
    }

  

相关文章:

  • 2022-12-23
  • 2021-11-22
  • 2021-06-24
  • 2021-04-06
  • 2021-07-14
  • 2022-12-23
  • 2021-11-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-24
  • 2022-01-11
  • 2021-07-16
相关资源
相似解决方案