我有 aEditText
和 a 的dailog Spinner
,我正在实施如下
spinner1 = (Spinner) dialog.findViewById(R.id.quesspinner);
ArrayAdapter<CharSequence> arrayadapter = ArrayAdapter.createFromResource(activity, R.array.fbquestion,R.layout.textview);
spinner1.setAdapter(arrayadapter);
logo.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
spinner1.setVisibility(View.GONE);
spinner1.performClick();
}
});
现在我无法读取 的值Spinner
,我希望 中的文本Spinner
显示在我的EditText
. 代码对我来说似乎很好,但它不起作用。感谢任何帮助
spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
int Text = parent.getSelectedItemPosition();
edittext.setText(Text);
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
// TODO Auto-generated method stub
}
});