spinner.getSelectedItemPosition(); spinner.getSelectedItem().toString(); 取不到所选的值?
spinner.setAdapter(aa);tableRow.addView(spinner);spinner.getSelectedItemPosition();sp...
spinner.setAdapter(aa);
tableRow.addView(spinner);
spinner.getSelectedItemPosition();
spinner.getSelectedItem().toString(); 展开
tableRow.addView(spinner);
spinner.getSelectedItemPosition();
spinner.getSelectedItem().toString(); 展开
1个回答
展开全部
为下拉列表设置事件的响应,这个事响应菜单被选中
spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
/* 将所选spinner 的值带入TextView 中*/
myTextView.setText("您选择的是:"+ adapter.getItem(arg2));
/* 将mySpinner 显示*/
arg0.setVisibility(View.VISIBLE);
}
spinner.setOnItemSelectedListener(new Spinner.OnItemSelectedListener(){
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
/* 将所选spinner 的值带入TextView 中*/
myTextView.setText("您选择的是:"+ adapter.getItem(arg2));
/* 将mySpinner 显示*/
arg0.setVisibility(View.VISIBLE);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询