[英]ExpandableListView not expanding
I used below code to set onGroupClickListener
in MainActivity
and I also set the OnLongClickListener
to view within getGroupView()
of my Custom adapter named MyExpandableListAdapter
. 我使用下面的代码在MainActivity
设置onGroupClickListener
,并且还将OnLongClickListener
设置为在名为MyExpandableListAdapter
自定义适配器的getGroupView()
中进行查看。
And then when I run the program onGroupClickListener
never fire either I return true or false from the OnGroupClickListener()
.If i remove OnlongClickListener
from getGroupView()
program run normally and onGroupClickListener()
will fire! 然后,当我运行程序onGroupClickListener
永远不会触发,我会从OnGroupClickListener()
返回true或false。如果我从getGroupView()
程序中删除OnlongClickListener
, onGroupClickListener()
正常运行,并且onGroupClickListener()
将触发! What's happening here and how to solve? 这里发生了什么以及如何解决?
If no that mean there is no way to set longClickListener
to groups of a ExpandableListView
?!!!Here is the code for OnGroupClickListener()
in MainActivity 如果不是那样,则无法将longClickListener
设置为ExpandableListView
组?!!!这是MainActivity中OnGroupClickListener()
的代码
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;
}
});
and here is the code for long press in MyExpandableListAdapter: 这是在MyExpandableListAdapter中长按的代码:
arg2.setOnLongClickListener(new OnLongClickListener(){
@Override
public boolean onLongClick(View view) {
DetailDialog.getDialog(screen.getContext(),(String)getChild(arg0,5));
return true;
}
});
Try this may help you 试试这个可能对你有帮助
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;
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.