【发布时间】:2014-08-20 22:27:20
【问题描述】:
我这两天就遇到这个问题,我在这里搜索解决方案,但没有找到任何东西。
问题如下: 我正在尝试设置复选框,它们是可扩展列表视图的每个子项的一部分。 我正在尝试设置它们,当我设置另一个复选框时,它不是可扩展列表视图的一部分。
那么我如何访问复选框?
我想从外部复选框的侦听器中访问它们。
chckbxAlleTage.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
int childrenCount = listAdapter.getChildrenCount(0);
if (chckbxAlleTage.isChecked()) {
for (int index = 0; index<childrenCount; index++ )
{
CheckBox tempchckBx = (CheckBox) (listAdapter.getChildView(
0, index, true,findViewById(R.id.LinearLayout1) , expListView))
.findViewById(R.id.chckBx);
tempchckBx.setChecked(true);
}
AnzahlTage = 7;
}else
{
AnzahlTage = 0;
}
setEtAnzahlTage();
}
});
此代码在侦听器中的结果是仅选中了一个复选框。 我希望有人能弄清楚这是什么问题。
thnx
【问题讨论】:
标签: android listview checkbox expandablelistview