我的应用程序中有一个可扩展的列表视图,每个组都有一个 textview 说 T 具有动态值,每个组都有一个子项。我想引用该组的 T textview 对象,其子项已被单击,以便我可以根据单击的子项相应地更改 T 的值。
在 groupClickListener 的情况下,我可以轻松获取 TextView 对象,但在 childClickListener 的情况下我无法获取...请在此处查看。
mExpandableListView.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
// TODO Auto-generated method stub
TextView moreTextView = (TextView)v.findViewById(R.id.group_more); // this works fine
}
return false;
}
});
mExpandableListView.setOnChildClickListener(new OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v,
int groupPosition, int childPosition, long id) {
// TODO Auto-generated method stub
boolean isExpanded=false;
if(groupStatus[groupPosition]==1)
{
isExpanded=true;
}
View v1 = parent.getExpandableListAdapter().getGroupView(groupPosition, isExpanded, v, parent);
TextView moreTextView = (TextView)v1.findViewById(R.id.group_more); // doesn,t work as v1 is null all the times
return false;
}
});