0
mySpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
    @Override
    public void onItemSelected(AdapterView<?> parentView, View selectedItemView, int position, long id) {
        // my code here, but I don't know how..
    }
}

我认为它会是这样的:

  1. 获取 mySpinner 的选中项位置
  2. switch(pos)
  3. 更新微调器条目?我不知道...

我不确定最后一步该怎么做。帮助?

4

1 回答 1

0

以这种方式尝试

    car.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> arg0, View arg1,
                int arg2, long arg3) {
            itemSelected = arg2;
              // add items to the cardetails spinner's adapter using the itemselected  and refresh the adapter using nofifyDataSetChanged()
        }

        public void onNothingSelected(AdapterView<?> arg0) {

        }
    });
    cardetails.setOnItemSelectedListener(new OnItemSelectedListener() {

        public void onItemSelected(AdapterView<?> arg0, View arg1,
                int arg2, long arg3) {

        }

        public void onNothingSelected(AdapterView<?> arg0) {

        }
    });

这里 car 和 cardetails 是微调器,您需要刷新与汽车微调器相关的适配器,以便微调器也得到刷新

于 2012-10-12T03:30:41.250 回答