80,359
社区成员
发帖
与我相关
我的任务
分享
LinearLayout checkboxLinearLayout = (LinearLayout) getLayoutInflater()
.inflate(R.layout.checkboxdoitem, null);
// 获得checkbox.xml文件中的CheckBox对象
CheckBox cbItem = (CheckBox) checkboxLinearLayout
.findViewById(R.id.checkBoxItem1);
cbItem.setTag(deptCodeList[i]);
cbItem.setText(deptNameList[i]);
ll.addView(checkboxLinearLayout, i);
你往II中添加的是LinearLayout,而不是CheckBox,当然无法将LinearLayout强制转换为CheckBox