无法选择微调器,其内部列表视图(Android)

时间:2015-11-25 14:33:14

标签: java android listview spinner

我有两个问题 1.旋转器无法选择。 2.获取微调项目(如果选择) 我尝试过很多东西,但如果有人能帮助我,我真的很感激,真的很感激 这是代码:

`

    public class MobileArrayAdapter extends ArrayAdapter<String> {
    private final Context context;
    private final List values;

    public MobileArrayAdapter(Context context, List values) {
        super(context, R.layout.req_row, values);
        this.context = context;
        this.values = values;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = (LayoutInflater)    context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        View rowView = inflater.inflate(R.layout.req_row, parent, false);
        TextView req_date = (TextView) rowView.findViewById(R.id.req_date);
        TextView request_time = (TextView)       rowView.findViewById(R.id.request_time);
        TextView task = (TextView) rowView.findViewById(R.id.tsk);
        TextView issue = (TextView) rowView.findViewById(R.id.issue);
        TextView employee_name = (TextView)         rowView.findViewById(R.id.emp_name);
        TextView contactno = (TextView) rowView.findViewById(R.id.contact);
        TextView department = (TextView) rowView.findViewById(R.id.dep);
        TextView comment = (TextView) rowView.findViewById(R.id.comment);
       // final Spinner empSpinner = (Spinner)            rowView.findViewById(R.id.spinner);
        HashMap<String, String> m = new HashMap<String, String>();
        m = (HashMap) values.get(position);
        req_date.setText(m.get("req_date"));
        request_time.setText(m.get("req_time"));
        task.setText("TSK/"+m.get("id"));
        issue.setText(m.get("Issue"));
        employee_name.setText(m.get("Emp_Name"));
        contactno.setText(m.get("Contact_No"));
        department.setText(m.get("Department"));
        comment.setText(m.get("Comment"));
        final Spinner empSpinner = (Spinner) rowView.findViewById(R.id.spinner);
        ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(context,
                R.layout.support_simple_spinner_dropdown_item, specialistsList);
        dataAdapter.setDropDownViewResource(R.layout.support_simple_spinner_dropdown_item);
        empSpinner.setAdapter(dataAdapter);
        empSpinner.setSelection(position);

        empSpinner.setOnItemSelectedListener(new        AdapterView.OnItemSelectedListener() {

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

            sp = empSpinner.getSelectedItem().toString();
        }
        @Override
        public void onNothingSelected(AdapterView<?> parent) {
            // TODO Auto-generated method stub
        }
    });
        Button send = (Button)  rowView.findViewById(R.id.snd_tsk);
        send.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {

                new Send().execute();
            }
        });

        return rowView;
    }
    }

`

0 个答案:

没有答案