Android 下拉菜单 Spinner 赋值
private Spinner m_spiModel = null; //产品型号 m_spiModel = (Spinner) findViewById(R.id.spiModel);//产品型号 String strModel_init="A型,B型,C型,D型"; String[] arrModel =strModel_value.split(",");//转换 数组 ArrayAdapter<String> adapter;//数组 配置器 下拉菜单赋值用 //将可选内容与ArrayAdapter连接起来 adapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,arrModel); //设置下拉列表的风格 adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); m_spiModel.setAdapter(adapter);//将adapter 添加到spinner中 m_spiModel.setVisibility(View.VISIBLE);//设置默认值