我使用下面的代码在onGroupClickListener
中设置MainActivity
,我还设置了OnLongClickListener
以查看名为getGroupView()
的自定义适配器的MyExpandableListAdapter
。< / p>
然后当我运行程序onGroupClickListener
时,我从OnGroupClickListener()
返回true或false。如果我从OnlongClickListener
程序正常运行getGroupView()
并{ {1}}会开火!这里发生了什么以及如何解决?
如果没有,则表示无法将onGroupClickListener()
设置为longClickListener
的组?!!!以下是MainActivity中ExpandableListView
的代码
OnGroupClickListener()
以下是MyExpandableListAdapter中长按的代码:
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;
}
});
答案 0 :(得分:0)
试试这可能会对你有所帮助
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;
exListView.expandGroup(groupPosition);//UPDATE HERE
return false;
}
});