如果我尝试设置 CheckBox 的选中状态,它不起作用,我已经阅读了其他人的许多线程,我所能得到的是它每次都返回一个不同的复选框,但我正在设置这个新的复选框,所以为什么它没有在我的微调器中检查?
classesName.setAdapter(new SpinnerAdapter() {
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public int getViewTypeCount() {
return 0;
}
@Override
public View getView(int arg0, View arg1, ViewGroup arg2) {
LayoutInflater inflater = Registeration.this.getLayoutInflater();
View spinView = inflater.inflate(R.layout.classes_registeration_ddl, null);
CheckBox rbtn = (CheckBox) spinView.findViewById(R.id.radioButtonClassesReg);
rbtn.setChecked(true);
return spinView;
}
@Override
public int getItemViewType(int arg0) {
return 0;
}
@Override
public long getItemId(int arg0) {
return arg0;
}
@Override
public Object getItem(int arg0) {
return classesArr[arg0];
}
@Override
public int getCount() {
return classesArr.length;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = Registeration.this.getLayoutInflater();
View spinView = inflater.inflate(R.layout.classes_registeration_ddl, null);
CheckBox rbtn = (CheckBox) spinView.findViewById(R.id.radioButtonClassesReg);
rbtn.setChecked(true);
return spinView;
}
});