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..
}
}
我认为会是这样的:
switch(pos)
我不知道该怎么办才能完成最后一步。帮助
答案 0 :(得分: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) {
}
});
这里的汽车和cardetails都是旋转器 您需要刷新与汽车微调器相关的适配器,以便微调器也可以刷新