我使用下面的代码进行设置onGroupClickListener
,MainActivity
并且还设置了我的自定义适配器中的OnLongClickListener
视图,名为.getGroupView()
MyExpandableListAdapter
然后,当我运行程序时,onGroupClickListener
从不触发我从返回 true 或 false OnGroupClickListener()
。如果我OnlongClickListener
从getGroupView()
程序中删除正常运行onGroupClickListener()
并将触发!这里发生了什么以及如何解决?
如果不是,则意味着无法设置longClickListener
为一组ExpandableListView
?!!!这是OnGroupClickListener()
MainActivity中的代码
exListView.setOnGroupClickListener(new OnGroupClickListener(){
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
gallery.setAdapter(new ImageAdapter(getBaseContext(),(Bitmap[]) exListAdapter.getChild(groupPosition, 7)));
lastClickedGroup=groupPosition;
return false;
}
});
这是 MyExpandableListAdapter 中长按的代码:
arg2.setOnLongClickListener(new OnLongClickListener(){
@Override
public boolean onLongClick(View view) {
DetailDialog.getDialog(screen.getContext(),(String)getChild(arg0,5));
return true;
}
});